Tried fixing around Animation Priorities but it doesn’t change anything. Also tried adding another way of walkAnimTrack:Stop() but then it breaks the other ways of playing it.
I believe the problem may be where the code is as shown.
Humanoid.Jumping
When you do that you play the jump animation without checking to stop any other animations. Try adding a line where it stops the walk animation once the humanoid jumps
I think your issue here is that you expect walkAnimTrack to play again after you’re done. Have the track play again once you finish the jump. If you want to go out the easy way just go:
humanoid.Jumping:Connect(function()
walkAnimTrack:Stop()
jumpAnimTrack:Play()
wait(x) --completely customizable, recommend to either time it off how long youre in air or length of anim
jumpAnimTrack:Stop() --this is here to ensure there wont be any more runs of the jump anim
walkAnimTrack:Play()
end)
Using my brain, I finally was able to figure out that the ‘‘Humanoid.Running’’ was the problem this whole time.
Here is the fix!
local RunService = game:GetService("RunService")
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local jumpSound = script:WaitForChild("JumpSound")
local walkAnim = script:WaitForChild("Walk")
local walkAnimTrack = humanoid.Animator:LoadAnimation(walkAnim)
walkAnimTrack.Priority = Enum.AnimationPriority.Movement
local idleAnim = script:WaitForChild("Idle")
local idleAnimTrack = humanoid.Animator:LoadAnimation(idleAnim)
idleAnimTrack.Priority = Enum.AnimationPriority.Idle
local jumpAnim = script:WaitForChild("Jump")
local jumpAnimTrack = humanoid.Animator:LoadAnimation(jumpAnim)
jumpAnimTrack.Priority = Enum.AnimationPriority.Action
idleAnimTrack:Play()
local function move()
if humanoid.MoveDirection.Magnitude > 0 then
if not walkAnimTrack.IsPlaying and idleAnimTrack.IsPlaying then
idleAnimTrack:Stop()
walkAnimTrack:Play()
end
else
if walkAnimTrack.IsPlaying and not idleAnimTrack.IsPlaying then
idleAnimTrack:Play()
walkAnimTrack:Stop()
end
end
if humanoid.Jump then
jumpAnimTrack:Play()
jumpSound:Play()
end
end
RunService.RenderStepped:Connect(move)
I decided to use RunService, and humanoid.MoveDirection. This prevents the walking, animation from getting confused. I figured speed was like just when a player moves at all. This helps clarify that jumping, and moving back and forth are two different things.