My character's idle animation only changes after moving

So it works, and changes my character’s idle and walk animation but…

It only changes after I start moving. Take a look at this GIF (I press C before I start moving in the GIF):

Here’s the code:

CR.OnServerEvent:Connect(function(Player, Crouch)
	if Crouch then
		Player.Character.Humanoid.WalkSpeed = 0; wait(0.01)
		Player.Character.Animate.walk.WalkAnim.AnimationId = "rbxassetid://6379482428"
		Player.Character.Animate.idle.Animation1.AnimationId = "rbxassetid://6368134178"
		Player.Character.Animate.idle.Animation2.AnimationId = "rbxassetid://6368134178"
		Player.Character.Humanoid.WalkSpeed = 4
	else
		Player.Character.Humanoid.WalkSpeed = 0; wait(0.01)
		Player.Character.Animate.walk.WalkAnim.AnimationId = "rbxassetid://6364251185"
		Player.Character.Animate.idle.Animation1.AnimationId = "rbxassetid://6364289318"
		Player.Character.Animate.idle.Animation2.AnimationId = "rbxassetid://6364289318"
		Player.Character.Humanoid.WalkSpeed = 6
	end
end)

Anyone know how to change it and have it update immediately without having to move?

What fires the function CR in the code?

A clientside scrip that detects when the player presses “C”.

can i see the part of the client side script that fires the remote?

Try making the animation for the idle loop. If it doesn’t work try upping the animation priority, besides that I have no clue what else to do.

The animation does work as intended; fairly sure it’s not an issue with that script.

Sure thing, sorry I didn’t include it before

if Key == "c" and not Crouching then
		StopSprint()
		wait(0.1)
		Humanoid.WalkSpeed = 4
		DefaultSpeed = 4
		Crouching = true
		CanSprint = false
		CR:FireServer(true)
	elseif Key == "c" and Crouching then
		DefaultSpeed = 6
		Humanoid.WalkSpeed = DefaultSpeed
		Crouching = false
		CanSprint = true
		CR:FireServer(false)
	end
CR.OnServerEvent:Connect(function(Player, Crouch)
	if Crouch then
Player.Character.Animate.walk.WalkAnim.AnimationId = "rbxassetid://6379482428"
		Player.Character.Animate.idle.Animation1.AnimationId = "rbxassetid://6368134178"
		Player.Character.Animate.idle.Animation2.AnimationId = "rbxassetid://6368134178"
		Player.Character.Humanoid.WalkSpeed = 0; wait(0.01)
		Player.Character.Humanoid.WalkSpeed = 4
	else
 Player.Character.Animate.walk.WalkAnim.AnimationId = "rbxassetid://6364251185"
		Player.Character.Animate.idle.Animation1.AnimationId = "rbxassetid://6364289318"
		Player.Character.Animate.idle.Animation2.AnimationId = "rbxassetid://6364289318"
		Player.Character.Humanoid.WalkSpeed = 0; wait(0.01)
		Player.Character.Humanoid.WalkSpeed = 6
	end
end)

try this

Tried, still waits until I move.

1 Like