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
Copy the script, delete the script object. And make it to a LocalScript, then paste it in. Done!