Issues regarding playing a default animation after loading it in

Hello people, I am currently setting default animations on characters through this function:

function loadDefaultAnim.loadDefaultAnim(char)
	--char.Parent = workspace:WaitForChild("Alive_Players")
	local humanoid = char:WaitForChild("Humanoid")
	local animator = humanoid:WaitForChild("Animator")

	-- Stop all animation tracks
	for _, playingTrack in animator:GetPlayingAnimationTracks() do
		playingTrack:Stop(0)
	end

	local animateScript = char:WaitForChild("Animate")
	animateScript.run.RunAnim.AnimationId = "rbxassetid://"
	animateScript.walk.WalkAnim.AnimationId = "rbxassetid://"
	animateScript.jump.JumpAnim.AnimationId = "rbxassetid://"
	animateScript.idle.Animation1.AnimationId = "rbxassetid://"
	animateScript.idle.Animation2.AnimationId = "rbxassetid://"
	animateScript.fall.FallAnim.AnimationId = "rbxassetid://"
end

However, whenever I do this the player has to first move and then stop to apply the new idle animation. Is there a way I can play the idle animation right away after setting these new animations? Thanks!

1 Like