How can I fix this? My Character keeps playing his walking animation even while idle and I don’t know how to script this.
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://8562381041"
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
idleAnimTrack:Play()
elseif speed > 0 then
runAnimTrack:Play()
else
runAnimTrack:Stop()
idleAnimTrack:Play()
end
end)
humanoid.Jumping:Connect(function(joe)
jumpAnimTrack:Play()
if joe then JumpSound:Play() end
end)
humanoid.Running:Connect(function(speed)
if speed > 0 then
runAnimTrack:Play()
idleAnimTrack:Stop()
else
runAnimTrack:Stop()
idleAnimTrack:Play()
end
end)
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://8562381041"
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 humanoid.Jumping == false then
if speed > 0 then
runAnimTrack:Play()
idleAnimTrack:Stop()
else
runAnimTrack:Stop()
idleAnimTrack:Play()
end
end
end)
humanoid.Jumping:Connect(function(joe)
jumpAnimTrack:Play()
if joe then JumpSound:Play() end
end)