Walk animation gets "smaller" everytime I change idle animation (and walkspeed)

I recently made this crouch script, and it all seems to be working fine (havn’t implemented crouch walking anim yet), but when standing up, the player’s walk animation gets “smaller”, its kinda hard to explain, and I am not very able to send a video, but basically, the player moves it’s arms, legs, and every other body part at a less intense rate then at the start.

Hide N Seek Tag - Roblox (press z to do the crouch thing)

I have no idea why, because it’s not like the animation isn’t playing, its just moving the player’s arms and legs less and less

heres da code:

local player = script.Parent
local humanoid = player:WaitForChild("Humanoid")
local uis = game:GetService("UserInputService")
local animate = player:WaitForChild("Animate")
local idle = animate.idle.Animation1
local animator = Instance.new("Animator", humanoid)
local crouchAnim = Instance.new("Animation")
local startCrouchAnim = Instance.new("Animation")
crouchAnim.AnimationId = 'rbxassetid://10798552591'
startCrouchAnim.AnimationId = 'rbxassetid://10798520553'

local crouching = false

local currentAnim
---sprint code I cut out---

uis.InputBegan:Connect(function(inp)
	if inp.KeyCode == Enum.KeyCode.Z then
		if crouching then
			animator:LoadAnimation(startCrouchAnim):Play(0.1, 1, -1)
			crouching = false
			idle.AnimationId = 'rbxassetid://507766388'
			currentAnim:Stop()
			animator:LoadAnimation(idle):Play()
			humanoid.WalkSpeed *= 2
		else
			animator:LoadAnimation(startCrouchAnim):Play()
			crouching = true
			idle.AnimationId = 'rbxassetid://10798717676'
			currentAnim = animator:LoadAnimation(idle)
			currentAnim:Play()
			humanoid.WalkSpeed /= 2
		end
	end
end)

pls help I still have no idea why this happens even after adding in the crouch walk anim (which also doesn’t work :< )

You have the both animations playing, while theyre on the same animation track, which causes animation overlap. To fix this, you can either reupload the animations on a differnt track, or stop the animations when they arent needed anymore.

Also this line here, would make you only be able to have the crouch animation play around 256 times.
I would recommend loading the animation in a table, and then replacing that line with

AnimationTable.StartCrouchAnim:Play(0.1, 1, -1)

You only need to load each animation object once (via LoadAnimation).You’re currently loading multiple animation track objects from the same animation object resulting in the overlap.

So do I just instead do something like

animator.startCrouchAnim:Play()

?

Or do I have to assign a variable to the animation each time?

I am now loading the animations and then just playing (and stopping) them, still seems to have a similar problem tho

---Animations---
local crouchAnim = Instance.new("Animation")
local startCrouchAnim = Instance.new("Animation")

crouchAnim.AnimationId = 'rbxassetid://10798717676'
startCrouchAnim.AnimationId = 'rbxassetid://10798520553'

---Loaded Animations---
local crouchAnimTrack = animator:LoadAnimation(crouchAnim)
local startCrouchAnimTrack = animator:LoadAnimation(startCrouchAnim)
local defaultIdleAnimTrack = animator:LoadAnimation(idle)

---Crouch---

uis.InputBegan:Connect(function(inp)
	if inp.KeyCode == Enum.KeyCode.Z then
		if crouching then
			crouchAnimTrack:Stop()
			startCrouchAnimTrack:Play(0.1, 1, -1)
			crouching = false
			humanoid.WalkSpeed *= 2
			startCrouchAnimTrack.Stopped:Wait()
			idle.AnimationId = 'rbxassetid://507766388'
			defaultIdleAnimTrack:Play()
			run.AnimationId = 'rbxassetid://913376220'
		else
			defaultIdleAnimTrack:Stop()
			startCrouchAnimTrack:Play()
			crouching = true
			humanoid.WalkSpeed /= 2
			startCrouchAnimTrack.Stopped:Wait()
			idle.AnimationId = 'rbxassetid://10798717676'
			crouchAnimTrack:Play()
			run.AnimationId = 'rbxassetid://10798552591'
		end
	end
end)

Also, for whatever reason, the run animation does not overpower the idle animation even though it has the priority of movement (i think I even set it to action just in case), while the idle having a priority of idle, is this because im playing it in a seperate script?

eee need helpppp why no reply XD

So i fixed this by setting the player’s animations and then restarting the default animate script