Waiting until a remote event has fired and "got through" to the server?

I am trying to stop the client animations the moment I fire the remote event and the server gets it.

I want the code in the red to not run until the server has noticed that the client fired a remote event.

(I’m doing this so that laggy players won’t end up with a basketball in their chest while waiting for them holding E to register.)

Is there an easy way to do this?

You can use RemoteFunctions instead, which will yield the rest of the localscript until the server completes its code.

I am aware of those however when I fire server there are waits etc that would affect the yielding time of the local script. I think I will just use a bool value to find out when the server got it and go from there.

The server should receive the event immediately.

You can use return when coding the OnServerEvent, and only run the code if it returns true or something, and use an If Statement to check. Or you can do

local result = remotes.DoAction:FireServer("Shoot", {state}
repeat wait(.1) until result == true

--rest of the code
remotes.DoAction:FireServer:Wait()

Will wait until remote gets resolved by the server.