It’s a pretty simple question for most of you probably but long story short, Im pretty new into scripting so there is a lot I dont know and recently with the limitations (removed EM from Sorts and 13 under can’t Play) that Roblox added to experimental mode games I need to take this seriously inorder to rescript my entire group place to FE. So my question is quite simple:
What is it that RemoteEvents do and how are they useful for FE?
Would appreciate if anyone could help me out,
RemoteEvents and RemoteFunctions are the best and most common way to send information from client to server and vice versa.
Since the client can’t tell the server what to do in FE, it’s necessary to call remotes as a kind of “request”, asking the server to do whatever the client wants (shooting a gun, casting a spell, etc).
Could you explain or link me to a quick guide on how I can use them since the Wikia is telling me nothing
You can find the wiki page for RemoteEvents, RemoteFunctions, BindableEvents, and BindableFunctions here. I suggest reading it as it’s definitely a very helpful page.
Another way of thinking about it that was helpful for me:
Imagine the server is an island. And all the clients (i.e. players), are other little islands around the server island. By default, there’s water separating the clients from the server. Therefore, they have no way of exchanging information.
So if you want to pass information from the server to the client (or vise-versa), you need to build a bridge between the two. A RemoteEvent or RemoteFunction acts as this bridge. A RemoteEvent is a one-way bridge, while a RemoteFunction is a two-way bridge.
You use a RemoteEvent when you just need to send information over the bridge but don’t need anything in return. You use a RemoteFunction when you want to send info but also want info back. You can also use a RemoteFunction to simply request information back, but not send any over.
Here’s a quick illustration I made:
In this scenario you should also think that the smaller island (the client) is always trying to sneak things into the bigger island (the server) so that they can attack, kind of like a trojan horse.
I went ahead and illustrated this with the help of @Crazyman32’s fine art
Because of this when the information comes in you must check that it’s what you would expect the smaller island (the client) to have sent you, and if all the values are correct (the equivalent of checking if the horse is made of wood or made of flesh), that means they can’t sneak anything into your island (the server). This is how you prevent exploits.
For example if you had a setup where the client tells the server ‘I just hit builderman with a pistol shot’ you might think to kill builderman straight away, but you should first check that the distance between the person firing and builderman is less than the pistol’s range, that there are no massive obstacles in the way, and that they haven’t already fired very recently (maybe like 20 ms ago). Once you’ve verified all this you can let the code to kill builderman run (rip) and reward the player a kill or whatever.
if only the citizens of troy read this post, they would still be here today.