PromptGameInvite will display an invite screen to the given
Player. On this screen, the player may invite their friends to the current game.
Before using this function, you should use the
SocialService/CanSendGameInviteAsync|CanSendGameInviteAsync function to determine whether a player can send a game invite, as this can vary depending on the platform or player. After determining that invites are possible for this player, allow the player to opt-in to inviting others. For example, the player clicked on an “Invite Friends” button, shown after
CanSendGameInviteAsync returned true.`
The player to prompt with the game invite screen
Sending a Game Invite
The following code sample demonstrates how to implement several
SocialService APIs to allow players to invite other players to your game.
In order to work as expected, the code sample must be placed in a
LocalScript descending from a
GuiButton. When the
Players/LocalPlayer touches or left clicks the GUI button, it executes openGameInvitePrompt() which opens the game invite prompt using
SocialService/PromptGameInvite after firing canSendGameInvite() to check if the player can send game invites using
When the player closes the invite prompt, the invitePromptClosed() function connected to the