Hello, Im trying to make a animations script for my rig, but its just animation plays while its running animation keeps getting overwritten by the jump animation, and the idle animation is having the same exact issue, and its not loading to. I have no idea why this is occurring in my script.
Im getting no errors In the output and I have no idea what is wrong with my game.
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local idleAnim = Instance.new("Animation")
idleAnim.AnimationId = "rbxassetid://7208722455"
local idleAnimTrack = humanoid.Animator:LoadAnimation(idleAnim)
local runAnim = Instance.new("Animation")
runAnim.AnimationId = "rbxassetid://8563922552"
local runAnimTrack = humanoid.Animator:LoadAnimation(runAnim)
local jumpAnim = Instance.new("Animation")
jumpAnim.AnimationId = "rbxassetid://8547783411"
local jumpAnimTrack = humanoid.Animator:LoadAnimation(jumpAnim)
local JumpSound = Instance.new("Sound")
JumpSound.SoundId = "rbxassetid://8396408200"
JumpSound.Volume = 2.7
JumpSound.Parent = humanoid.Parent:WaitForChild("Torso")
idleAnimTrack:Play()
humanoid.Running:Connect(function(speed)
if speed > 0 then
runAnimTrack:Play()
idleAnimTrack:Stop()
else
runAnimTrack:Stop()
idleAnimTrack:Play()
end
end)
humanoid.Jumping:Connect(function()
jumpAnimTrack:Play()
JumpSound:Play()
end)