Loop only makes it once instead of looping (Statement was true)

So basically when u move or stop it will do the corrosponding animation, when i tried debugging the loop only printed once

I have no idea what happened, move direction was working fine so the only thing that made me think was the loop though idk how to fix it

(Output had no errors)

local ContextActionService = game:GetService("ContextActionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")

local Events = ReplicatedStorage.Events
local CrouchEvent = Events.CrouchEvent
local Player = Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Animate = Character:WaitForChild("Animate")

local Animation1 = Instance.new("Animation")
Animation1.AnimationId = "http://www.roblox.com/asset/?id=12255580424"

local Animation2 = Instance.new("Animation")
Animation2.AnimationId = "http://www.roblox.com/asset/?id=12255579410"

local Status = false

function Crouch(ActionName, InputState, InputObject)
	if InputState == Enum.UserInputState.Begin then
		CrouchEvent:FireServer(true)
		Status = true
		repeat
			if Humanoid.MoveDirection.Magnitude == 0 then
					for _, Animation in ipairs(Humanoid:GetPlayingAnimationTracks()) do
						if Animation.Priority == Enum.AnimationPriority.Action then
						Animation:Stop()
					end
					local Track1 = Humanoid:LoadAnimation(Animation1)
					Track1:Play()
				end
			else
				for _, Animation in ipairs(Humanoid:GetPlayingAnimationTracks()) do
					if Animation.Priority == Enum.AnimationPriority.Action then
						Animation:Stop()
					end
				end
				local Track2 = Humanoid:LoadAnimation(Animation2)
				Track2:Play()
			end
			task.wait()
		until Status == false
	elseif InputState == Enum.UserInputState.End then
		CrouchEvent:FireServer(false)
		Status = false
		for _, Animation in ipairs(Humanoid:GetPlayingAnimationTracks()) do
			if Animation.Priority == Enum.AnimationPriority.Action then
				Animation:Stop()
			end
		end
	end
end

ContextActionService:BindAction(1, Crouch, true, Enum.KeyCode.LeftShift)

Have you done print(Status) right before until Status == false? Does it even get to that point?

You can also check when Status is being set to false by printing something right before the Status = false line.

It seems like the InputState is ending right after it begins, but I’d expect it to run more than once… try the above things for now.

yes, but the thing is its not leaving the loop when the status is false but still its not looping

If it’s not leaving the loop, that would mean it keeps looping, no? But you’re saying it isn’t looping… Can you explain?

Like it’s neither leaving the loop or looping like it’s stuck on something but still I couldn’t figure it out