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

My script works in roblox studio but does not work in a server or a game?

When I play the game in studio it works but when I try to load it on a server or by clicking play it does not work. Help??? The script is a item button on a gui shop that is supposed to spawn a right red brick above you when you click it.

player = game.Players.LocalPlayer.Character:WaitForChild("Torso")
Item1 = script.Parent.Item1
Item2 = script.Parent.Item2
debounce1 = true
debounce2 = true


Item1.MouseButton1Click:connect(function()
	if debounce1 then
		debounce1 = false
		local newItem1 = Instance.new("Part", game.Workspace)
		newItem1.CFrame = CFrame.new(player.Position.X, 10, player.Position.Z)
		newItem1.BrickColor = BrickColor.new("Bright red")
		wait(1.5)
		for i = 0, 1, 0.1 do
			newItem1.Transparency = i
			wait()
			if newItem1.Transparency == 1 then
				newItem1:Remove()
				debounce1 = true
			end

1 comment

0

Copy the script, delete the script object. And make it to a LocalScript, then paste it in. Done!

1 answer

Hi, have you tried using it as a LocalScript?

1 comment

0

This is a suggestion and so should be used in comments not answers

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