Questions about InvokeClient

So I am working on a game that invokes the client and asks them if they want to accept an invite.

First question. How??? Shouldnt this invoke the server and send plr and plr2?? I checked if they are not the same player and indeed they are two different players

local inviteSucces = invitePlayer:InvokeServer(player,player2)

Anyhow on the server plr and plr2 are the exact same thing and I dunno why.

Second is it a good idea to send a remote function the a client for them to accept something? Or is there a better way to do this?

With Remote Events and Remote functions, the first argument for the function on the server that’s listening (Wether invoked or fired, doesn’t matter; so long as it’s being received on the server) is the player that sent the remote event or function. Therefore You only need to send one player (The player that isn’t the client) from the client, and the server will get them both

1 Like

You only want to use InvokeServer with RemoteFunctions. An exploiter can intercept the client callback and never resolve it, hanging your server indefinitely.

I personally just use two events for this. The server fires the client telling it to prompt the player with something, and the client fires an event with the results when it’s ready.

I created a back up system for this :smiley:

Wait with remote functions do I not need to send the player who fired it? Is it an automatic value?

Yes just like remote events the first argument is the player who fired the remote event / remote function that the server is receiving

1 Like