How do I wait for a remote function to return?

Theres probably a topic on this but I cant find it at all!
So how do I How do I wait for a remote function to return?
Thanks!

i’m pretty sure remote functions yield the script automatically until they return so i don’t think you have to worry about that

Oh. . . well ok.
Wait how do I get what it returns?? I forgot ngl

here’s an example

--client
local returned = remoteEvent:InvokeServer()
print(returned)
--server
remoteEvent.OnServerInvoke = function()

return "hi"

end

2 Likes

you’d do the opposite with server to client

instead of :InvokeServer() you’d do :InvokeClient(player) and on the client you’d do .OnClientInvoke

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.