Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

why will this click detection script not work in real game?

Asked by
Plieax 66
6 years ago

I do not get any errors in testing but it just won't work in the real game... please help

local this = script.Parent
local plr = this.Parent.Parent.Parent.Parent

this.Activated:connect(function()
    if plr.Backpack:FindFirstChild("Hot Dog") then
        plr.Backpack:FindFirstChild("Hot Dog"):Destroy()
        plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value + 10
        plr.PlayerGui.quest1gui.Frame.TextBox.Text = "Thank You :)"
        this:Destroy()
        wait(3)
        plr.PlayerGui.quest1gui:Destroy()
    end
end)
0
is script.Parent.Parent.Parent.Parent.Parent really the player? did it work as intended in testing? did output say anything? were there any errors in the developer console? I'm guessing you're using a normal script for this and not a local one. The server does not have direct access to the player's playergui vanilla_wizard 336 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Try using a Local script and change local plr = this.Parent.Parent.Parent.Parent to local plr = game.Players.Localplayer

Ad

Answer this question