The Animations Will Not Play For My Sword Combat System

  1. What do you want to achieve?
    Creating A Sword Combat System

  2. What is the issue? Include screenshots / videos if possible!
    The issue with it is that it seems to be working like there’s no error what so ever in the output but the animations will not load whenever I’m trying to attack nothing happens but when I get close to the dummy it does damage the only thing that works in the system is the damage but I need the animations to load as well. I even own the animation and checked multiple times if the humanoid and animation are valid which they are.

  3. What solutions have you tried so far?
    I’ve tried countless solutions from replacing the animation ids for the same animation which didn’t work but I owned all of them, I asked countless programmers in Hidden Developers, I’ve indented, capitalized, I’ve turned off can collide, I’ve done everything possible and it still won’t work.
    Code:

local tool  = script.Parent
local cooldown = script.Cooldown.Value
local animation = script.Swing



tool.Activated:Connect(function()
    local humanoid = tool.Parent:FindFirstChildWhichIsA('Humanoid')
    if humanoid and cooldown == false then
        cooldown = true
        local playanim = humanoid:LoadAnimation(animation)
        playanim:Play()
        tool.Handle.Damage.Disabled = false
        wait(0.25)
        tool.Handle.Damage.Disabled = true
        wait(0.5)
        cooldown = false
    end
end)

I would advise setting the animation priority to ‘Action’ both within the animation editor and the script.

Refer to this for more information:

Roblox Wiki Source

2 Likes

Have you tried placing print functions in the conditional statements to check whether the code is actually running? It may be an issue that the code is completely overlooking the program because it doesn’t fulfil the if statement’s conditions.

It would also be worth putting a else print("Either Humanoid wasn't found, or cooldown was true") just to double check.

Hope this helps,
-Tom :slight_smile:

Alright thank you but I’ve already set the animation priority to action though.

Yes I have and they’ve printed.