Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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)

1 comment

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

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.