-
I am trying to animate a custom character.
-
My Issue The code isn’t working and all I am getting is a bobbing head.
-
I have tried I have changed the humanoid hip height but it didn’t work and the character has a Animator.
Here is the code in a In a Local Script in StarterCharacterScript.
local runAnim = "rbxassetid://--myAnimationCode" --the walk animation
local humanoid = script.Parent.Humanoid
local animTrack --for doing extra code on top
humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()
animTrack = humanoid:LoadAnimation(runAnim)
if humanoid.MoveDirection.Magnitude > 0 then -- if the humanoid is trying to move,
animTrack:Play()
elseif humanoid.MoveDirection.Magnitude <= 0 then -- if the humanoid is not moving/stopped moving
animTrack:Stop()
end
end)
Thanks for the help, Code On!