The animation won't stop and will become abnormal

So I’m trying to make an FPS framework, and when I was trying to make a walking animation for my arms the animations just keep stacking, and don’t stop.

In this framework what I have so far are 2 scripts consisting of a local script, and a module script.

Local Script Problem:

Runservice.RenderStepped:Connect(function()
	if not (hum.MoveDirection.Magnitude <= 0) and Debounce == true then
		print("walking")
		dequip = true
		Debounce = false
	elseif (hum.MoveDirection.Magnitude <= 0) and Debounce == false then
		print("stop")
		dequip = false
		Debounce = true
	end
	
	if dequip == true or dequip == false then
		mainmodule.equip(viewmodel, AnimationsFolder.Walk, dequip)
		dequip = nil
	end
end)

Module Script Problem:

function module.equip(viewmodel, walk, dequip)
	local Walk = viewmodel.AnimationController:LoadAnimation(walk)
	if dequip == true then
		return Walk:Play()
	end
	
	if dequip == false then
		return Walk:Stop()
	end
end

Video of the Problem:

Feedback is always appreciated :slight_smile:

Could you send a video of what’s happening?

1 Like

Thank you for reminding me.
I have added a video to the post.