Live server delay breaking my game

The game is a freeze tag game, when I test on studio server everything works perfectly fine no delay, no bugs.

I have a collision block covering the player and welded to it, I use that for hit detection, however, when players collide the function i use to freeze/thaw people gets called more than once…

Now you’d say “use a debounce” and I am, I’m using multiple ways to denounce, having a bool set to false until the function is done being called, checking inside the function if the player is already frozen or thawed, etc… but nothing seems to work…

as you can see the IDs are spammed, even though in one of the checks I use :FindFirstChild(userid)

So my question is, what could be causing this? what can I, or should I do to solve this or help me determine the issue.

I’ve been trying to solve this all day q.q

What is your debounce code?

local canTcheck = true
collisionBlock.Touched:connect(function(h)
		local pHit = game.Players:GetPlayerFromCharacter(h.Parent)
		if pHit and h.Name ~= "BBall" then
			if GameSettings.GameOn.Value == true then
				if (char.HumanoidRootPart.Position - h.Parent.HumanoidRootPart.Position).magnitude >= 5 and canTcheck then
					local isTagger = PlayerManager:Exe("get", plr.userId).Tagger
					canTcheck = false
					if isTagger then
						if not GameSettings.FrozenList:FindFirstChild(pHit.userId) then
							_G.CurMode:Exe("tag",plr,pHit)
						end
					else
						if GameSettings.FrozenList:FindFirstChild(pHit.userId) then
							_G.CurMode:Exe("tag",plr,pHit)
						end
					end
				end
			end
			canTcheck = true
		end
	end)

Solved :smiley:

The issue wasn’t my checks or denounces. in my code that handles the freezing / thawing players I tell the server that the said player is frozen after I set their stats which caused a delay.

Thanks to @jewelycat and @1waffle1