I have need to request information from my client. However, I have been advised to not use RemoteFunctions to call to a client with OnClientInvoke, considering if there is a distruption with the client, the thread, that it was called in, will hang forever waiting a response.
So… is there any way that a specific thread could be created, that has the OnClientInvoke ,and an outside timer checking on that thread’s status, so that if there is no response after x seconds, the entire thread is destroyed, and the OnClientInvoke is not hanging somewhere in memory?
I would think something in the way similar to pcall, to where I can get a reply of success,result
I am a total noob at creating threads and before I try to learn all of this, I just needed to know it its possible to create a thread, monitor it in from some sort of outside code, and kill it, freeing OnClientInvoke.
Just use remote event twice, events don’t hang like functions, and errors on the client won’t carry over to the server. You can also start a timer after firing the event for timeouts
Like Luke said you can, but there’s problems with solutions like that.
You really need to know if you in-fact need a RemoteFunction here, for example if you wanna share a boolean, you can use a RemoteEvent to send info to the server, and then the server applies it, etc.
If you really need to use a RemoteFunction, then well, at least you can know that the thread will error out when the player leaves.
Also if the problem is just the fact that it might give you a false/fake value from an exploiter, well you can’t do anything about that.
Not sure at the top of my head how to do it properly though.
I am no worried about exploits so much, and it would only hurt the client in this case.
I have a movement script that controls flying and swimming on the client, and when doing certain things from the server, I need to make sure that script is paused, so I really just needed a way to send the client a signal to pause, and either get a reply that its done, or get an error that it timed out.
So, just so I understand, there is no built in timeout or return of error in the roblox remotefuctions?
The remote event twice seems overly complicated, and I am not sure how I would handle reading a return for a specific ‘fire’