EDIT: Thursday, May 28th
Good evening Robloxia,
Earlier today, we have enabled the SocialService API and its members.
Players have been able to invite their friends into games for a while now through the ESC menu, and now this new API allows you to prompt your players to invite their friends into your games!
But wait; there’s more! You may even connect to the GameInvitePromptClosed
event and receive details when users close the invitation dialog.
(Side note: This event will still fire even if the player decides to open the menu themselves from the ESC menu.)
This is the cool Invitation Popup players will see.
And then, the recipients will receive a chat message prompting them to join their game. Sweetness!
With this feature, we hope to encourage our developers to further enhance the social Roblox experience.
Documentation
Documentation is currently pending on the Developer Hub and a link will be posted here once it is available.
Expand Documentation
SocialService facilitates social functions that impact relationships made on the Roblox platform.
Developers are able to prompt their players to send game invitation requests to players’ friends and leverage signals when users invite their friends to their games
Function: SocialService:CanSendGameInviteAsync
Summary: Returns true if the targetPlayer can send chat messages.
This may yield. This function may only be invoked from a LocalScript.
Usage
Use this method to determine if the targetPlayer is able to send game invites. After calling this method, use the result to determine if elements should be disabled or rendered invisible to avoid a poor user experience when SocialService:PromptGameInvite does not do anything.
Since this method is not guaranteed to execute without throwing, it is advised to wrap the usage of this function with a pcall.
Parameter: Player targetPlayer: The player instance of the user used to determine if the client can send a game invite.
Error: Will error if called from a Script. Will error if web response is not successful.
Function: SocialService:PromptGameInvite
Summary: Prompts the targetPlayer with the Game Invite popup. This function may be invoked from a LocalScript or Script. If the player cannot send game invites, this prompt will be ignored by the targetPlayer. See SocialService:CanSendGameInviteAsync
Parameter: Player targetPlayer: This Player will be shown the Game Invite popup.
Error: This will error if called from a LocalScript and the targetPlayer parameter is not the LocalPlayer.
Event: SocialService.GameInvitePromptClosed
Summary: An event invoked when a player has closed the game invite prompt. This prompt can be prompted by the developer using SocialService:PromptGameInvite or accessed by the user from the SettingsHub/Esc menu.
Parameter: Player senderPlayer: The player instance who has closed the prompt.
Demo
Here is an open sourced demo of this new feature. Handle with care!