- What do you want to achieve?
Simple Walk,Idle, and Jump animation that works for a certain Character Rig of mine.
- What is the issue?
Idle, Walk anim work, but when a player jumps, it either stops all animations, or starts walking even when they are not moving.
Take a look at this topic : Walking Animation Playing When Not Supposed To
https://gyazo.com/980e31ac212a13752386babd0868d80f
- What solutions have you tried so far?
I tried fixing -
humanoid.Jumping:Connect(function()
walkAnimTrack:Stop()
jumpAnimTrack:Play()
end)
to
humanoid.Changed:connect(function()
if humanoid.Jump then
jumpAnimTrack:Play()
end
end)
But it still doesn’t make a difference.
Here is the full code:
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
humanoid.Running:Connect(function(speed)
if speed > 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
end)
--humanoid.Jumping:Connect(function()
-- walkAnimTrack:Stop()
-- jumpAnimTrack:Play()
-- jumpSound:Play()
-- wait(0.5)
-- jumpAnimTrack:Stop()
-- idleAnimTrack:Play()
--end)
humanoid.Changed:connect(function()
if humanoid.Jump then
jumpAnimTrack:Play()
end
end)
idleAnimTrack:Play()
Could it be because of the speed > 0 ?
If I do
humanoid.Changed:connect(function()
if humanoid.Jump then
jumpAnimTrack:Play()
jumpSound:Play()
wait(0.5)
jumpAnimTrack:Stop()
idleAnimTrack:Play()
end
end)
It works normally, but then breaks the idle animation to where it doesn’t even work anymore.