Animation is not playing?

i did an animation and export it, the animation is for a custom character i made, i have all the joints and welds and humanoidrootpart, and a primary part as well
image
image

the script has no error either
image
local character = script.Parent
local humanoid = character:WaitForChild(“Humanoid”)

local walkAnim = script:WaitForChild(“Walk”)
local walkAnimTrack = humanoid.Animator:LoadAnimation(walkAnim)

humanoid.Running:Connect(function(speed)
if speed> 0 then
–play animation
if walkAnimTrack.IsPlaying then
walkAnimTrack:Play()
end
else
– stop animation
if walkAnimTrack.IsPlaying then
walkAnimTrack:Stop()
end
end
end)

i new to this animation stuff so idk what to do

I think your problem is at the line where your code says the walkAnimTrack variable, i dont realy understand why you typed humanoid.Animator but insted type humanoid:LoadAnimation(walkAnim) , this should do

This part of the code only plays the animation if it is already playing. Does it work if you add not to the if statement?

my animation still does not play, thx for the help tho

no it does not work sorry, thx for the help tho

I loaded the code into a blank place with a placeholder walk animation and it works for me. All I can suggest at this point is to make sure that the priority of the animation is not Core so that it plays over top of the default animations.

Just in case, here’s how I implemented the code:

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")

local walkAnim = script:WaitForChild("Walk")
local walkAnimTrack = humanoid.Animator:LoadAnimation(walkAnim)

humanoid.Running:Connect(function(speed)
	if speed> 0 then
		if not walkAnimTrack.IsPlaying then
			walkAnimTrack:Play()
		end
	else
		if walkAnimTrack.IsPlaying then
			walkAnimTrack:Stop()
		end
	end
end)

thanks i think that was my problem because i had prioty set as core

1 Like