As you can see by the title, do remote events and remote functions need to be in replicated storage?
Thanks!
As you can see by the title, do remote events and remote functions need to be in replicated storage?
Thanks!
They don’t NEED to be in replicated storage, however that’s definitely the best place to host them. You can put them in a lot of other places (besides obvious ones like serverstorage and serverscriptservice), however you should host them there.
RemoteEvents allow you to communicate from server to client, they need to be in a replicated area (e.g. the character, workspace)
ReplicatedStorage is still the best place to keep them.
This might be a bit off topic, but why is replicatedstorage more ideal? I have a interaction system in one of my projects and my remotevents are in individual parts in workspace, is this a vulnerability or is it just not good performance wise?
It’s not a vulnerability because either way the client will have access to it. It’s the same performance wise. It’s kept in ReplicatedStorage to keep your game organized. When all your remotes are in the ReplicatedStorage you won’t have to go searching through random parts for them. You’ll only have them in one place rather than having them spread out.
Doing them in individual parts like that is viable and there is no noticeable performance hit or vulnerability. however, lets say you had one remote (for all your interactions) in replicated storage (or another replicated area like jointsService) you would only have to use OnServerEvent once. Ontop of that you would have less instances and in return a more organized codebase. One remote could easily control all of your interactions simply by doing a check on the server as to “What interaction is trying to be handled here”. At the end of the day it really doesn’t matter if you don’t care about the extra instances. Just personal preference.
Remotes do not need to be in ReplicatedStorage, however it’s sort of a conventional standard on Roblox for developers to leave them there. This is especially so in more neater structures where you can clearly see where remotes are.
The point of keeping them in ReplicatedStorage is due to the nature of the service where its contents are available to both the server and the client. Most developers are conditioned to keeping their remotes here since there really isn’t any other appropriate place to put them and it fits in with the greater majority of code involving client-server interaction.
Think of the placement of remotes in ReplicatedStorage as canonical. You don’t have to put them there, but you should.
Remote Events don’t need to be in the replicated storage, it can be anywhere, but the serverstorage and serverscriptstorage, because the server storage is not going to be replicated in-game and it won’t work in the serverscriptstorage. The reason people put it in the replicated storage is because it’s good for oganization
No, they don’t have to be in Replicated Storage. They can be in models as far as I know.
You can put them anywhere, but if you’re putting them somewhere other than ReplicatedStorage you’d better have a very good reason why.
Using them 100% correctly in dynamic cases such as dynamically copied models is surprisingly difficult. Consider the cases of calling a remote function / firing a remote event before the script on the other end finishes its WaitForChild("Remote").On... = function ...
. Are you sure you know what’s going to happen?
No, remote events do not need to be in ReplicatedStorage, they can be located in: Workspace, ServerStorage, ReplicatedStorage, a Part, a Tool, a model.