RemoteEvents in tools

A lot of times, I see RemoteEvents being used in tools. RemoteEvents can be fired by any player, so presumably another player could fire the RemoteEvent doing the action for the player which holds the tool. I don’t see many people check if its the correct player firing the remote event. If this is true (in studio Player2 can fire the RemoteEvents in Player1’s tools) then presumably an exploiter could for example fire a gun for another player.

Am I losing performance by checking if the correct player is firing the RemoteEvent, or am I just removing an issue which could be abused by exploiters?

1 Like

No, this is a very minimal operation; using the player argument returned from the invoked event you’ll be sure that that’s the player firing the event. If you use this player argument to find which gun to fire it shouldn’t be possible to abuse.

6 Likes

I currently use something like this,

local Players = game:GetService"Players"
script.Parent.RemoteEvent.OnServerEvent:Connect(function(player,...)
    if player == Players:GetPlayerFromCharacter(script.Parent.Parent) then
        --code
    end
end)

Although, why don’t more people do something like this? It seems fairly obvious.

3 Likes