Animations not working

Basically my animation doesn’t work and I tried to make it work but still the animation never plays

this is the script

local player = game.Players.LocalPlayer
local tool = script.Parent.Parent
local handle = script.Parent
local punchbool = script.Parent:WaitForChild("IsPunching")
local cooldown = script.Parent.PunchCooldown
local event = script.Parent.Event
local swing = script.Parent.SwingSound
local animator = player.Character:FindFirstChild("Humanoid"):WaitForChild("Animator")
local animationtrack = animator:LoadAnimation(script.Parent.Punch)


tool.Activated:Connect(function()
	print("coolio")
	animationtrack:Play()
end)

help pls

You’re using :FindFirstChild when searching for the humanoid. If this script runs when the player joins, it won’t be able to find the player’s humanoid, therefore not finding the animator.

so wat do i use

sorry am beginner scripter

use :WaitForChild instead of :FindFirstChild

idk why its still not working i own the animation maybe its because its in the tool?

Why do you have the script inside the Handle?, put it inside the Tool?

Does “coolio” get printed?

Char limit

yea it gets printed (limit aaaa)

ill try that (limit again aaa)

I usually define the animation THEN load it in with animator
like this:

local anim = script:WaitForChild("Animation")
local Loadanim = animator:LoadAnimation(anim)

Alright, so first make sure that you’ve actually assigned the animationId to the Punch animation instance, sometimes we can get a little gullible and forget about that

yup put in my animation (eeee)

He’s doing the exact same thing except its not on a variable

lemme try that (effeefeffefeffeeee)

actually wait tools are really finicky and can prevent animations from playing, its most likely that

is it also weird my handle has no touch interest (like all my tools got it)

You can fix this by Disabling a function in the Roblox Provided Animator

No, because your not listening for touches, your listening for clicks

try doing animator:LoadAnimation(script.Parent:WaitForChild(“Punch”)

nope, prints out the stuff but no animation yet