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

My weapon system doesnt function as intended?

Asked by 1 year ago

Im trying to make a tool with an attack animation and a cooldown, my system may be funky but if you can help please do. It tells me there are no errors but it doesnt deal damage to the dummy and the cooldown doesnt exist.

function attack()
    script.Parent.Handle.Touched:Connect(function(hit)
        if hit.Parent:FindFirstChild("Humanoid") then
            hit.Parent.Humanoid:TakeDamage(30)

            warn("Hit successful")

        end
    end)
end

script.Parent.Equipped:Connect(function(Mouse)
    Mouse.Button1Down:Connect(function()
        local animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation)
        animation:Play()
        attack()
        script.Disabled = true
        wait(3)
        script.Disabled = false
    end)
end)

Answer this question