Help with Invite System

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?

2 Likes

When browsing the Developer Hub, I found this API page:

This seems like it would fire when a player invites a player.

1 Like

You cant use it because its under RobloxScriptSecurity.

True. You can’t access CoreScripts.

Nobody was talking about CoreScripts here.

Wait, are RobloxSecurityScripts and CoreScripts not related?

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.

Hey there, I’m not sure if this is what your looking for but you can try this!

It was disabled because developers were abusing it by rewarding players in-game items.

1 Like

I think you might just have to have normal friend boosts, where it doesn’t matter if they joined from an invite.

Maybe try this:

https://developer.roblox.com/en-us/api-reference/function/Player/IsFriendsWith

Ok I guess. But many games still have these systems, how do you do it?

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?

1 Like