Resume the loop after return end

trying to create m1 dummy with the ability to be stunned when getting parried

m1 work but when it got stunned once it just stop the whole loop and standing still
any idea how I can fix this?

while true do
	if Stunned.Value == true then return end
	if CurrentAnim < 4 then
		CurrentAnim += 1
	else
		CurrentAnim = 1
		wait(1)
	end
	local Animtrack = Animator:LoadAnimation(script["Punch ".. CurrentAnim])
	Animtrack:Play(.2)
	Animtrack:GetMarkerReachedSignal("Hit"):Connect(function()
		CreateHitbox()
	end)
	Animtrack.Stopped:Wait()
	table.clear(Hit)
end

Instead of using return use continue.

Simple.

1 Like

I accidentally use continue without wait() but still thank you for remind me of its existence

No worries. Goodbye!

1 Like