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

GUI on-touch popup script works In studio but not in the real game?

Asked by 6 years ago

Not sure what i'm doing wrong, i have FE turned on and the script works in the studio but not in the game. It's a GUI script that is supposed to pop up when a player touches a brick, but won't work in studio. (Yes, it's a localscript).


local player = script.Parent.Parent.Parent.Parent function sell(part) if part.Parent:FindFirstChild("Humanoid") then player:WaitForChild("TotalFood") local SellCount = player.TotalFood.SCount.Value local SellValue = player.TotalFood.SValue.Value if SellCount >=0.1 then player.PlayerGui.Gui:WaitForChild("Sold").Visible = true player.PlayerGui.Gui.Sold.Text = ("Successfully Sold ".. SellCount .. " Items for $".. SellValue .." !") wait(2) player.PlayerGui.Gui.Sold.Visible = false end end end game.workspace.Sellbrick.Touched:connect(sell)

1 answer

Log in to vote
0
Answered by 6 years ago

Local scripts don't always work in the Workspace. Try moving it into StarterPlayer > StarterCharacterScripts. You may need to edit your scripts a bit for them to work.

Ad

Answer this question