Footstep module uglyburger0

I’m trying to use uglyburger0’s footstep module. I already understand the basics, but how would I go about repeating the sound while the character is moving? I’ve been experimenting for so long but I can’t seem to get it
current code

Humanoid.Running:Connect(function()
	if Humanoid.MoveDirection.Magnitude > 0 and not dashing then
			local mat = FootStepModule:GetTableFromMaterial(Humanoid.FloorMaterial)
			local ran = FootStepModule:GetRandomSound(mat)
			local sound = CreateSound(ran, 1)
			task.wait(sound.TimeLength)
	end
end)
1 Like

something like this could work:

local isPlaying = false

Humanoid.Running:Connect(function()
	if Humanoid.MoveDirection.Magnitude > 0 and not dashing then
		if not isPlaying then
			isPlaying = true
			while Humanoid.MoveDirection.Magnitude > 0 and not dashing do
				local mat = FootStepModule:GetTableFromMaterial(Humanoid.FloorMaterial)
				local ran = FootStepModule:GetRandomSound(mat)
				local sound = CreateSound(ran, 1)
				sound:Play()
				task.wait(sound.TimeLength)
			end
			isPlaying = false
		end
	end
end)