Ok, I’m trying to make an Invite system. If the player invites a friend, they will get a reward of some kind (I’m not sure yet). I’ve been reading on the forums and it says the API was removed. However, many games still have a reward-based invite system.
How can I track if the player has invited friends through the default SocialService GUI?
I said, that you cant use this event, because its under RobloxScriptsSecurity, which means it can only be used in CoreScript. Even if you were able to access CoreScripts, you still would not be able to use that event.
Create a button inside of the StarterGui. Customize it to your liking. The look of the button doesn’t matter.
Create a local script under the button and paste this code inside:
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.CanSendGameInviteAsync, SocialService, targetPlayer)
return res and canSend
end
local function promptGameInvite(targetPlayer)
local res, canInvite = pcall(SocialService.PromptGameInvite, SocialService, targetPlayer)
return res and canInvite
end
local function openGameInvitePrompt(targetPlayer)
local canInvite = canSendGameInvite(targetPlayer)
if canInvite then
local promptOpened = promptGameInvite(targetPlayer)
return promptOpened
end
return false
end
local function invitePromptClosed(senderPlayer, recipientIds)
-- Handle custom logic for players invited by sender
button.Visible = false
end
local function onActivated()
openGameInvitePrompt(player)
end
button.Activated:Connect(onActivated)
SocialService.GameInvitePromptClosed:Connect(invitePromptClosed)
-- Hide the button until we've checked that the player can send game invites
button.Visible = false
button.Visible = canSendGameInvite(player)
button.Activated:Connect(onActivated)```
I already have the button, and it does prompt the invite. The problem is that Roblox disabled the recipientIds argument, which sees how many players were invited.
Games are still using a rewarded invite system, even though this is disabled. But somehow it still works. How are they doing this, and how could I pull this off?