Would it be ok to put RemoteEvents inside of a tool rather than another place?

I was wondering if I were to put RemoteEvents inside of a tool rather than putting them inside of ReplicatedStorage would be better in some cases for the sake of keeping your game neat and tidy, or should I just keep all of my RemoteEvents inside of ReplicatedStorage?

I’m not sure if I were to keep RemoteEvents inside of a tool it would give exploiters an easy way to exploit the game or if it wouldn’t even matter at all because to the extent of my knowledge the client can access and modify ReplicatedStorage.

I keep several events in my tools, especially when I only want the player to be able to utilize those events.

Technically speaking it doesn’t make much difference seeing-as an exploiter would be able to access both ReplicatedStorage and events held within tools, so it’s a matter of preference, which do you think looks tidier/which would help you organize your game better.

2 Likes

I wouldn’t really worry about exploiters having easy access to your remotes or not, aslong as what is being done on the server-side is secure then you have nothing to worry about. They can only exploit your remotes if you allow them to. I personally use RemoteEvents inside my tools only because i choose to give each tool its own local and server scripts. If you are using one server script to handle all your gun functionalities then you are probably better off just using one RemoteEvent.

If you wanna use RemoteEvents inside tools a nice way to make it neat and tidy is to clone any scripts/Remotes into the tools as the server starts up.

There’s nothing wrong with placing RemoteEvents in tools.

You need to remember that with RemoteEvent’s, the client cannot access the remote itself if it isn’t in a replicated compartment.

So you wouldn’t be able to place RemoteEvent’s or RemoteFunction’s in the following places:

  • ServerScriptService
  • ServerStorage
  • ReplicatedFirst (possible but not recommended, read the documentation on the service itself here)
1 Like

So how would I define the RemoteEvent in a server script in ServerScriptService? How would I be able to access that specific player’s tool that fired the event?

You would define it the same way you would in the tool.
Assuming that they are only firing the event when the tool is equipped you could do something like;

local Tool = Player.Character:FindFirstChildOfClass("Tool")

Yes that’s right, it won’t make a difference in the sense of being able to access them.

Other than that it’s just preference, objects under ReplicatedStorage are guaranteed to replicate before LocalScripts execute, you can use this fact to access them easier on both the server and client.

The location of your remote instances do no matter, what matters is how you secure them, here is a link to an article further explaining how this is done:Tutorial: Properly Validating User Input.