Idle animation not changing back to default when un-crouching

I am making some basic movements for my game, and I am currently making a crouch system, however, the default animation does not change back to standing up when un-crouching even though they use the same code as crouching (except with different animation IDs)

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

---Sprint code that 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'
			animator:LoadAnimation(idle):Play()
			humanoid.WalkSpeed *= 2
		else
			animator:LoadAnimation(startCrouchAnim):Play()
			crouching = true
			idle.AnimationId = 'rbxassetid://10798717676'
			animator:LoadAnimation(idle):Play()
			humanoid.WalkSpeed /= 2
		end
	end
end)

There is nothing stopping the animation from continuing to play.
Use

Animation:Stop()

or

Animation:Destroy()

thank you so much ill try this when I have time