Basically, I have a local script that fires a remote event (on the server). What I want is for the local script to wait a few seconds after the remote event is finished. However, I find that if I put code after the remote event triggering, it runs while the remote event is still being ran, not after (like a normal function call would work in a script). Is there any (not overcomplicated/messy) way to achieve what I’m looking for?
Least complicated would be to just put a task.wait(a few seconds)
after you fire the remote event.
If you need to know that the remote has finished, then you could consider using a RemoteFunction. That would prob be okay for your case since it’s a client calling the server. The RemoteFunction is not asynchronous like the RemoteEvent, so it will pause the script until a result is returned.
You could have the server set some kind of variable that the client script watches until it changes to the expected value. “Watching” here could mean you set up an event handler that triggers when the value is changed, or the LocalScript could enter a loop with a wait in it that keeps checking the variable.
You could set it up so that the code that runs after is in it’s own function and have the server send another RemoteEvent back to the client.
That’s most of the easy-ish ways that come to mind.