I’ve already read the documentation for remote functions and it does state some of the things that might happen if you do use it from server to client but I’m still a bit paranoid since it only lists a few and there may be more. The reason I need to use it from server to client is because I need a callback from a gui. The server will tell the client to make a certain gui visible, then the client will respond to the gui and send that data back to the server. I could also do this with 2 remote events but I’m not sure if I should do that if I can simply just use a function.
This seems like a valid use case for a RemoteFunction
, however it might not be recommended. The documentation is quite vague when it states this:
The keyword here is potential. The documentation says that the game can break if your script can potentially have an error or if the client yields forever. It’s fine if you manage your code correctly. The documentation suggests that there should be one RemoteEvent
that sends the text through a TextBox
.
However, if you want to still set this system up properly, you can try this:
-
Make the GUI visible on the server, since the visible property replicates.
-
Create a
RemoteEvent
, or use an existing one. -
Connect the event only when the GUI is visible to prevent the client from spamming the server with data. (optional)
-
When the user is done entering the data through the GUI, have an enter button that the user clicks on and that will fire a
RemoteEvent
with the proper data. -
Disconnect the event after some time in case the client doesn’t ever respond. (only if you did optional step 3)
There are no guarantees that this is the best or most efficient solution, but it should work if set up correctly.