I'm making a round script where when somebody steps on a part, they get teleported back to the lobby and the script adds one value for TotalCountedPlayers that stepped on that part. The problem is that I set a print function and it's printing more than once even with debounce.
if plr and char and plr:FindFirstChild('GameTag') then
for _, TaggedParts in pairs(CollectionService:GetTagged("ObbyRewardsTag")) do
TaggedParts.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local char = plr.Character
local hum = char:FindFirstChild("Humanoid")
local humRootPart = char:FindFirstChild("HumanoidRootPart")
local DB = false
if plr and char and DB == false and hum and humRootPart and plr:FindFirstChild("GameTag") then
DB = true
TotalCountedPlayers.Value = TotalCountedPlayers.Value + 1
plr.LeaderStatsFolder.Stonks.Value = plr.LeaderStatsFolder.Stonks.Value + RandomAmount
humRootPart.CFrame = LobbySpawner[1].CFrame
table.remove(LobbySpawner, 1)
DB = false
wait(.5)
print("Went Up By One")
end
end)
end
end
end

2 comments
Sorry about the wrong answer, I left an edited code and an explanation at the bottom that should hopefully work
it fixes one thing which is the teleporting, but the problems are not completely fixed, sorry.