Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Best method for preventing RemoteEvents from being spammed?

My original idea was to use a RemoteFunction to check the debounce timer so that the RemoteEvent can't be spammed but i'm afraid that there would be delays since it is being done on the server.

I did a bit of research and another solution i found was to simply add a debounce on the server script so that the RemoteEvent can't be fired super fast but this is also done on the server so there would definitely be delays.

Which of these method would be the best? Or if neither of them are efficient methods then what are some suggestions i can get to prevent exploiters from spam firing RemoteEvents?

1 answer

I've used dictionaries. Something like this:

local cd = {}
remote.OnServerEvent:Connect(function(plr)
	if cd[plr.Name] == 1 then
		plr:Kick()
	end
	cd[plr.Name] = 1
	-- the whole code, and if u want it to be done again
	cd[plr.Name] = nil
end)

Hope I helped. this works perfect for me, i've tested with many exploits and with all of them works.

5 comments

0

^even with a lot of lag, and a lot of delays, there is no problem using this method.

0

So on line 7, do i also have to include the time the remote event has to wait before firing again?

0

Yes, so it doesnt instantly go nil, and exploiters can't spam that remote event. If it worked accept my answer please ;)

0

Make sure to do this check in a slightly different way on the client because the client might have a millisecond of lag at the wrong time and end up getting kicked.

0

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.