Do I HAVE to put Remote/Bindable Functions/Events in ReplicatedStorage/ServerStorage?

Let’s say I make a door that automatically opens for all clients/player when one client/player steps close to it. Can I put the event inside of the door? And an event definer inside it too? I know this isn’t the best example, but I was just wondering.

You could use a .Touched event on a invisible/no-collide box beside the door.

If you want to send any client data to the server you will need a Remote Event/Function. Keep in mind .Touched events on the server are exploitable just like remote events, hackers can fire them whenever/where ever they like.

For your situation, probably not as you can just do:

local part = script.Parent

  --your code

If you’re doing something on a localscript and you want something that all players can see, then a remote event/function is crucial.

1 Like

@gertkeno @josephgotdeletedbymo

My question was if I HAVE to put them in ReplicatedStorage/ServerStorage. I forgot to put that in the title my fault. The part with the example was just an example, but thanks for some answers to that.

Remote Events/Functions don’t have to be in replicated storage, but they do have to be visible to both the client and the server to be useful. Replicated storage is a good place for Remote Events because it’s children are loaded before the game starts, allowing players to connect to the events without missing them down the line.

For example, if content streaming is enabled and your remote event is in the workspace, the client may decide to unload it thus destroying connections, whenever Roblox needs to free up some memory. This would be difficult to work around for the client scripts.

Bindable events probably shouldn’t go in replicated storage since they do not need to be seen by both the client and the server, but nothing is stopping you from placing them in Replicated Storage. A more appropriate space depends on your use case, I like to keep them near or direct children of scripts that use the bindable event.