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

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

Asked by 7 years ago
Edited 7 years ago

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

1 answer

Log in to vote
0
Answered by 7 years ago

Hi, have you tried using it as a LocalScript?

0
This is a suggestion and so should be used in comments not answers farrizbb 465 — 7y
Ad

Answer this question