How do I limit values being added to the player?

I’m trying to add a win system to my obby game, I have the leaderboard working but I am having trouble with the scripting. My problem is that the game keeps awarding the player wins over and over if the condition is met. How can I make it only award the player once?

local function setupCheckpoints()
for stage = 1, #checkpoints do
	local checkpoint = checkpoints[stage]
		
	checkpoint.Touched:Connect(function(hit)
		local player = getPlayerFromPart(hit)
			
		if player then
			if delays[player] then return end
			delays[player] = true
				
			local playerStage = player.Data.Stage.Value
			local character = player.Character
			local humanoid = character.Humanoid
			local isAlive = humanoid:GetState() ~= Enum.HumanoidStateType.Dead
				
			if isAlive then
				if stage > playerStage then
					player.Data.Stage.Value = stage
				end
			end
				
			if playerStage > 51 then
				player.Data.Stage.Value = 51
				warn("Checkpoint Error: Overflow") 
			end
				
			if playerStage == 51 then
				player.Data.Wins.Value += 1
				print("Checkpoint Notification: Win Added")
			end
				
				
			task.wait(1)
			delays[player] = nil
			end
		end)
	end
end

Is this if statement inside of a loop or a changed event. Cause it can’t detect changes without it.

Yes, I should have copied the entire code block. Look at my original post for the full code.

Disconnect this connection or your set a “blacklist” system. (Like a cooldown, not sure if yours is working.)

You could try instead use “>=” instead of “==”, so that it isn’t that strict on the number.