I have a custom walking animation script because I have a custom character in this game of mine.
I have three animations I have made for it: Walking, Dashing, and Jumping.
Dashing and Jumping ones work, but for some reason the walking animation will not work.
Heres the walking animation script:
local walkanim = game.ReplicatedStorage.Animations.Walk
local walk = script.Parent:WaitForChild("Humanoid"):WaitForChild("Animator"):LoadAnimation(walkanim)
script.Parent:WaitForChild("Humanoid").Running:Connect(function()
if not walk.IsPlaying then
walk:Play()
end
end)
And heres my jumping animation script:
local anim = game.ReplicatedStorage.Animations.Jump
local jump = script.Parent.Humanoid.Animator:LoadAnimation(anim)
script.Parent.Humanoid.Jumping:Connect(function()
if not jump.IsPlaying then
jump:Play()
end
end)
The reason I am showing the jumping animation script is because they’re almost identical and I am very confused as to why the walking won’t work.
local anim = game.ReplicatedStorage.Animations.Walk
local walk = script.Parent.Humanoid.Animator:LoadAnimation(anim)
script.Parent.Humanoid.Running:Connect(function()
if not walk.IsPlaying then
walk:Play()
end
end)
What I used to do when having custom animations was playing the game in Studio, copy the character’s “Animate” LocalScript, paste it into StarterCharacterScripts and replace the certain AnimationIds with the custom animations.
That is, if all players are supposed to have the same animations though.
The humanoid state you are catching with the event, Running, it only fires, when you come from another state, such as falling, landed, getting up, etc…
So most likely your event is not firing.
For walking you need to have a loop, that checks the velocity of your HumanoidRootPart, and if you are in a Running state, and velocity is > or < than a value, play the walk or run or idle animations.