Animation doesnt play

“Just to make sure that everything works right”
“Event fired”
“Attempting to load animation hopefully”
“Animation finished”

Everything except the animation works (it doesnt play)… I did republish it too.

This is in a local script right?

Yeah it is in a LocalScript inside the Tool

1 Like

whats up with this line?

local animation = script.Parent:WaitForChild("Animatio")

shouldn’t it be ??

local animation = script.Parent:WaitForChild("Animation")

Yes i fixed that already, my current script is from @Jackscarlett :

local Plr = game.Players.LocalPlayer
local Char = Plr.Character or Plr.CharacterAdded:Wait()
local Animation = script.Parent:WaitForChild("Animation")
local Animator = Char:WaitForChild("Humanoid"):WaitForChild("Animator")

local canSwing = true
local DB = 1

script.Parent.Activated:Connect(function()
	if canSwing then
		canSwing = false
		local PunchAnim = Animator:LoadAnimation(Animation)
		PunchAnim:Play()
		wait(DB)
		canSwing = true
	end
end)

Ya your script works for me
robloxapp-20211229-1309180.wmv (450.7 KB)
here’s a video if you want to look

what my tool looks like
image

local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local animation = script.Parent:WaitForChild("Animation")
local animator = character:WaitForChild("Humanoid"):WaitForChild("Animator")
local punchAnimation = animator:LoadAnimation(animation)

local canSwing = true
local debounce = 1

script.Parent.Activated:Connect(function()
	if canSwing == true then
		canSwing = false
		punchAnimation:Play()
		wait(debounce)
		canSwing = true
	end
end)

How did you create the animation, R6 or R15?

I’ll ask this question:

Are you using the correct AnimationID in your Animation Object? It should look something like this:
image

Heres my rig
image
how made it
image
And yes it’s R6

There might be a problem with your animation

image

ill try creating another animation

1 Like

Are you sure your animations are published under you and not a group?
If the game is made in your group then you need to publish the anim owner to the group amd vice versa.

1 Like

Good point, I forgot about that. if this is true it would fix the problem

They are published under myself
For some reason the animations dont load on my side

Try removing the :WaitForChild("Animator") part

Humanoid:LoadAnimation() is deprecated. Use Animator:LoadAnimation() instead.

try debugging. like

print("this is working!")

every line that does it job like

local Plr = game.Players.LocalPlayer
local Char = Plr.Character or Plr.CharacterAdded:Wait()
local Animation = script.Parent:WaitForChild("Animation")
local Animator = Char:WaitForChild("Humanoid"):WaitForChild("Animator")

local canSwing = true
local DB = 1

script.Parent.Activated:Connect(function()
    print("This is working 1")
    if canSwing then
        print("This is working 2")
        canSwing = false
        local PunchAnim = Animator:LoadAnimation(Animation)
        PunchAnim:Play()

        wait(DB)
        canSwing = true
        print("This is working 3")
    end
end)
print("This is working last")