Player movement stuck while playing other animation

Hi, I am trying to make a basic crouch script for my game.
What’s happening is if I crouch, and then try to move in any direction, I can not move until uncrouched. The weird thing is though, if I move first, and then press crouch, I can move freely and crouch at the same time

I have searched up through quite a few forums looking for an answer. I’ve tried changing the animation type to action, doesn’t work. Movement? Doesn’t work. Core? Doesn’t work.

Here is the code I wrote for this script:

task.wait()
local uis = game:GetService("UserInputService")
local char = script.Parent
local humanoid = char:WaitForChild("Humanoid")
local animator = humanoid.Animator
local crouch = script.Animation
local track = animator:LoadAnimation(crouch)
uis.InputEnded:Connect(function(rem, proc)
	if proc then return end
	if rem.KeyCode == Enum.KeyCode.LeftControl then
		task.wait()
		print("Crouch Stop")
		track:Stop()
	end
end)
uis.InputBegan:Connect(function(input, proc)
	if proc then return end
	while uis:IsKeyDown(Enum.KeyCode.LeftControl) do
		task.wait()
		print("Crouch")
		track:Play()
	end
end)

If anyone knows why this is happening, please tell me.

Try changing your HumanoidRootPart tranparency so you can see it and then crouch and see where it ends up I thinking maybe its being put in the ground on ground and not positioned right for the humanoid to change velocity and move unless the character already has velocity

I thought the HumanoidRootPart was stuck too, but I turned the transparency of the HumanoidRootPart and made it vibrant green, and noticed that it doesnt move at all.