Collapse Sidebar


CanSendGameInviteAsync indicates whether the given Player can invite other players to the current game. If they can, it returns true.

You should always use the result of this function before the SocialService/PromptGameInvite|PromptGameInvite function, since the ability to invite players can vary depending on the platform or player. Only after determining that invites are possible for this player, should you allow the player to opt-in (eg, a button press) to inviting others using the PromptGameInvite function.


Name Type Default Description

The player instance of the user used to determine if the client can send a game invite


Return Type Summary

Whether the specified player can send a game invite

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)