Collapse Sidebar


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.`


Name Type Default Description

The player to prompt with the game invite screen


Return Type Summary

No return

Code Samples

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 SocialService/CanSendGameInviteAsync.

When the player closes the invite prompt, the invitePromptClosed() function connected to the SocialService/GameInvitePromptClosedevent fires.

local SocialService = game:GetService("SocialService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local button = script.Parent

local function canSendGameInvite(targetPlayer)
	local res, canSend = pcall(SocialService.CanSendGameInvite, SocialService, targetPlayer)
	return res and canSend

local function promptGameInvite(targetPlayer)
	local res, canInvite = pcall(SocialService.PromptGameInvite, SocialService, targetPlayer)
	return res and canInvite

local function openGameInvitePrompt(targetPlayer)
	local canInvite = canSendGameInvite(targetPlayer)
	if canInvite then
		local promptOpened = promptGameInvite(targetPlayer)
		return promptOpened
	return false

local function invitePromptClosed(senderPlayer, recipientIds)
	-- Handle custom logic for players invited by sender
	button.Visible = false

local function onActivated()


-- Hide the button until we've checked that the player can send game invites
button.Visible = false
button.Visible = canSendGameInvite(player)