Remote event spam filter

Any potential problems or improvements?

local counts = {}
local function returnInventory(player)
	if counts[player] then
		counts[player] = (counts[player] + 1)
	else
		counts[player] = 1
	end

	if counts[player] > 10 then 
		warn(tostring(player).." spamming remote")
		counts[player] = nil
		player:Kick(":(")
		
		return
	end 

	task.delay(1, function() 
		if counts[player] then
			counts[player] -= 1 
			if counts[player] == 0 then
				counts[player] = nil
			end
		end
	end)
	
	local inventoryStore = DataStore2("Inventory", player)
	return inventoryStore:Get()
end
1 Like

Ban them using a strike system.

3 Likes

Maybe change that 10 to a 5.

2 Likes

dont kick them. instead make large text in the chat that displays their credit card information, then give them a loud jumpscare

6 Likes

:roll_eyes::roll_eyes::roll_eyes::roll_eyes:

nah just create a textbox saying “type your phone number here” and make everyone see what he is typing inside it using userinputservice.inputbegan

1 Like