My Remote checker keeps banning people for no reason

Alright so, I have an event that fires every time a Player uses their tool(Which is a lot). I have a global table called local playerClickSecurityCounters = {}. Everytime a player clicks, under the OnServerEvent we do playerClickSecurityCounters[playerThatclicked] = playerClickSecurityCounters[playerThatclicked] + 1.

Then, I have a security loop constantly looping through the playerClickSecurityCounters and checking to make sure they meet the threshold every second.

local clickSecurityThreshold = 6
coroutine.resume(coroutine.create(function()
	while true do
		for Player,Val in pairs(playerClickSecurityCounters) do
			local a = Val - clickSecurityThreshold
			if a <= clickSecurityThreshold then
				playerClickSecurityCounters[Player] = 0
			elseif a > clickSecurityThreshold then
				--Punish Them
			end	
		end
		
		wait(1)
	end
end))

The MINIMUM wait time a Player will have under their clicker is .25(That is with all gamepasses, devproducts, buffs). So the max amount of times a Player should be clicking in a second is 4 times a second. Yet, I am constantly receiving false ban reports. I have raised the threshold but then exploiters are able to find it and do their thing so. I am sorta stuck here and plan to fix this today. Anything I can be doing better or other ways? Or things I am doing wrong?

Edit: I should also mention the max amount of people in this table would be 24 on a full server.

Maybe the part where it says “playerClickSecurityCounters[Player] = 0” isn’t properly being set back to 0 due to some sort of server lag issue or something. I’m not quite sure though.

I have actually just reconstructed the entire thing. Instead of checking the entire table every 1 second, I have moved the checks under the remote event’s OnServerEvent itself. This seems to have fixed the problem but we’ll see!

2 Likes