How to get a response from the client on the server?

I’m trying to make a teleport prompt system which will ask a client if they accept somebody to teleport to them. I need to verify the response on the server.

My original idea was to use a RemoteFunction from the server to the client, but of course that is never guaranteed to return and could lead to issues server side. My second idea was to send a RemoteEvent to the client to display the prompt, and the client can send a RemoteEvent back to the server with whatever response they chose. The server could then set a value with the response, and the server logic could check for that response somewhere. Another idea I had was to use a RemoteFunction and implement a timer system for it where after x seconds, it would automatically reject.

Either way, there does not seem to be a great way to go about this. I am leaning towards that last idea. Any insights on the best way to do this would be appreciated!

Just use remote events!

→ Means client to server or server to client depending on the context

Player 1 → Server [“Hey, can you ask [Player 2] if I can teleport to them please?”]
Server → Player 2 [“Yo, Player 1 wants to teleport to you, do you accept?”]
Player 2 → Server [“Yeah that’s ok!”]
Server [“Cool, well you already have a teleport request pending so this request is legit, let me bring Player 1 over to you”]