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

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

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

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.

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