In which line do i insert debounce?

i am having trouble on picking on which line to put the debounce for it to work

local rs = game:GetService("RunService")
local soundfolder = script.SoundFolder:GetChildren()

local debounce = true
rs.Stepped:Connect(function()
	
	local last = nil
	for i,v in pairs(game.Players:GetChildren()) do
		if last == nil then
			last = v
		end
		if debounce then
			debounce = false
	
		if last.Character and v.Character then
			if last and last~= v then
			local dist = (last.Character.HumanoidRootPart.Position-v.Character.HumanoidRootPart.Position).magnitude	
	            for i,b in pairs(soundfolder) do
		        local randomnum = math.random(1,#soundfolder)
			    if i == randomnum then
						local sound = b:Clone()
						sound.Parent = last.Character
						sound.Volume = 10
						sound:Play()
			         	if dist <= 5 then
			   					print("The player "..v.Name.." is close to "..last.Name)
								wait(5)
								debounce = true
			                 	end
							  last = v
						end	
					end
	              end
               end
			end
	    end
	end)

ok so what does the script do?

Without any context as to what the script is meant to achieve, this is an educated guess.

Currently it is assigned to false if debounce is true, however it’ll only be assigned back to true Iif it passes all the if statements. Consider only assigning it to false if it passes every condition required.