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

why doesnt my tool work in play mode but works in studio ?

Asked by 9 years ago
bin = script.Parent
me = script.Parent.Parent.Parent

enabled = true

function onButton1Down(mouse)
if not enabled then
        return
    end

    local player = game.Players.LocalPlayer
    if player == nil then return end
      enabled = false 
        Run = game:GetService("RunService")     
        game:GetService("Chat"):Chat(me.Character.Head, "Chloro Balls!")
        for i = 1, 100 do
            randomer = math.random(-5,5)
            randomer2 = math.random(-2,2)
        x = Instance.new("Part")
        x.BrickColor = BrickColor.new("Lime green")
        x.Size = Vector3.new(4, 4, 4)
        x.TopSurface = "Smooth"
        x.BottomSurface = "Smooth"
        x.Shape = "Ball"
        x.Name = me.Name
        x.CanCollide = false
        x.Transparency = 0.5
        y = Instance.new("BodyVelocity")
        y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
        y.velocity = me.Character.Torso.CFrame.lookVector*500
        x.Parent = Workspace
        y.Parent = x
        x.CFrame = me.Character.Torso.CFrame * CFrame.new(randomer, randomer2, -10)
        game.Debris:AddItem(x, 6)
        wait()
        end
   wait(8)

    enabled = true

    end


enabled = true 
function onS(mouse) 
mouse.Button1Down:connect(function() onButton1Down(mouse) end) 
end 
bin.Selected:connect(onS)

Answer this question