So, I have little knowledge on how exploiters actually use and spam events, but I know that they can fire any event they want.
I’m wondering if having if statements inside of an onserverevent function would prevent the exploiter from spamming the event unless they meet the requirements for the if statements.
Event.OnServerEvent:Connect(function(player))
if player.Name == “Owner Name” then
end
end)
I would assume that the server would follow the if statement, but I have no concept on how powerful these exploiting programs can be.
Also, I don’t really see people using if statements in the code to direct an event(maybe I haven’t looked enough), but is there problems that may occur from this?
Actually, exploiters could use the remote regardless since the remote is actually replicated to their machine and since the client actually needs to fire the remote, what prevents the exploiter from actually abusing the remote are the if statements(sanity checks) which should be done on the server.
Your code example is essentially correct, but it does not stop spamming. You have to implement a debounce, but this would not be necessary since only the game owner would be allowed to use the remote.
This is a very common practice to secure remotes. You could read my tutorial on replication security if you’d like