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

Why isn't it working?

Asked by 9 years ago

I made a script which launches a fireball, and I added the damage script.When the fireall deals damage to a humanoid, the script stops working ( I mean that I cannot launch anotherafter I launched the first and it touched a humanoid)

wait(3)
Player = script.Parent.Parent.Parent
n = script.Parent
local debounce = false
mouse = Player:GetMouse()
run = game:GetService("RunService")
function pizza(mouse)
    if debounce == false then
        debounce = true
            local x = Instance.new("Part")
            x.Shape = "Ball"
            x.CanCollide = false
            x.TopSurface = "Smooth"
            x.BottomSurface = "Smooth"
            x.Transparency = 0.45
            x.Parent = Workspace
            x.Size = Vector3.new(10, 50, 10)
            x.BrickColor = BrickColor.new("Bright red")
            x.Name = Player.Name
            y = Instance.new("BodyVelocity")
            y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
            y.velocity = Player.Character.Torso.CFrame.lookVector*110
            x.Parent = Workspace
            y.Parent = x
            f = Instance.new("Fire", x)
            f.Heat = 0
            f.Size = 12
            x.Touched:connect(function(Part) 
    if Part.Parent:FindFirstChild("Humanoid") ~= nil then
        script.Disabled = true
        for i = 1,20 do  
        Part.Parent.Humanoid.Health =  Part.Parent.Humanoid.Health -1
        wait(0.05)
        end
    end
    wait(0.025)
end)
            x.CFrame = Player.Character.Torso.CFrame*CFrame.new(0, 0, -10)
            game.Debris:AddItem(x, 10)

    end
    wait(35)
    debounce = false
end




function onSelected(mouse)
    mouse.Button1Down:connect(function() pizza(mouse) end)
end

n.Selected:connect(onSelected)

1 answer

Log in to vote
0
Answered by
yumtaste 476 Moderation Voter
9 years ago

You disabled the script on line 30, and then you never re-enabled it.

0
Ah, Thank you. brokenrares 48 — 9y
0
It would really help me if you accepted my answer. It gives both of us 1 rep. yumtaste 476 — 9y
Ad

Answer this question