Social growth: invites, referrals, notifications and events

Grow a Roblox game through its players: a Call your crew invite prompt with LaunchData, a referral reward that pays once, opt-in experience notifications through Open Cloud, and Scrap Rush as an experience event with in-game RSVP.

Concept lesson, about 75 minutes, 10 steps

By the end you can

  • Offer an invite prompt at the right moment with SocialService and ExperienceInviteOptions, and read LaunchData on the server
  • Pay a friend referral once, after real play, without trusting ReferredByPlayerId
  • Send a personal experience notification through Open Cloud, and say who can receive it and how often
  • Publish Scrap Rush as an experience event and let players RSVP from inside the game

Before this: LiveOps: updates, events, feature flags, migrations, ProfileStore: the library pros use, Security: never trust the client

1A lost drill is an invitation

At m14-ship, the end of a drill pays only the players who are still standing:

local function awardSurvival()
	for _, player in Players:GetPlayers() do
		local character = player.Character
		local humanoid: Humanoid? = nil
		if character then
			humanoid = character:FindFirstChildOfClass("Humanoid")
		end
		if humanoid and humanoid.Health > 0 then
			local balance = DataService.addCoins(player, Config.SURVIVAL_BONUS)
			Analytics.coinSource(
				player,
				Config.SURVIVAL_BONUS,
				balance,
				Enum.AnalyticsEconomyTransactionType.Gameplay.Name,
				"SurvivalBonus"
			)
			Analytics.onboarding(player, "SurvivedDrill")
			BadgeAwards.award(player, "FIRST_DRILL")
Figure 1.1

Everyone whose Humanoid.Health is 0 gets nothing. That player is now the person most likely to want help, and the least likely to want a pop-up in the middle of a fight. Roblox gives you four ways to turn players into new players, and each one fits a different moment:

Beacon Yard's social loopSix boxes in a loop. A lost drill on the server leads to a Call your crew button on the client, then a friend joins, finishes a first drill on the server, the referral pays both players in saved data, and an opt-in notification brings the inviter back.playsreturnsLost drillno bonusCall your crewinvite promptFriend joinsjoin dataFirst drillproof of playReferral paysonce, savedNotificationopt-in, 1 a day
Figure 1.2. One loop, four Roblox features: an invite prompt, a referral, a notification and, around it all, the Scrap Rush event.

Match each Roblox feature to what it does for Beacon Yard.

  1. Invite prompt
  2. Friend referral
  3. Experience notification
  4. Experience event
Answer

Invite prompt: Lets a player who just lost a drill send friends a join notification; Friend referral: Tells the server who invited the new player, so both can be rewarded; Experience notification: Pings one opted-in player about something personal, at most once a day; Experience event: Puts Scrap Rush on the game page with a Notify Me button. Invites and referrals work while friends are together in the game. Notifications and events reach players who are not playing right now.

Open this step in lesson mode · Link to this step · This confused me

2The Call your crew button

An invite prompt is a Roblox window, shown to one player, that lists their friends with Invite buttons. Invited friends get a notification that joins them straight into the game1. It takes two calls on the client:

  1. SocialService:CanSendGameInviteAsync(player) says whether this player may invite on this platform. It is a network call, so wrap it in pcall.
  2. SocialService:PromptGameInvite(player, options) opens the prompt. options is an ExperienceInviteOptions object2.
luau
local SocialService = game:GetService("SocialService")
local Players = game:GetService("Players")
 
local player = Players.LocalPlayer
 
local options = Instance.new("ExperienceInviteOptions")
options.PromptMessage = "Call your crew for the next drill"
options.LaunchData = "crew"
 
local function callCrew()
	local ok, canSend = pcall(function()
		return SocialService:CanSendGameInviteAsync(player)
	end)
	if ok and canSend then
		SocialService:PromptGameInvite(player, options)
	end
end

ExperienceInviteOptions has four properties. PromptMessage is the text the sender sees (Roblox hides it if it overflows the window). InviteUser targets one friend by user id. InviteMessageId points at a notification string you write in Creator Hub, which must contain {experienceName}. LaunchData is a note of up to 200 characters that the friend's join carries into the game.

Where should Beacon Yard show the Call your crew button?

  1. On the end-of-drill screen of a player who did not survive, at most a few times per session
  2. As soon as a player spawns, before they touch a coin pad
  3. Every time the drone hits a player, so they can get help right away
  4. Automatically, by calling PromptGameInvite on every client from the server each round
Answer

On the end-of-drill screen of a player who did not survive, at most a few times per session. Ask at a natural pause, when the request makes sense, and let the player press the button. The prompt itself opens only when they do.

Open this step in lesson mode · Link to this step · This confused me

3Reading the pass at the gate

Client sideAn invite with LaunchData is a guest pass a player writes out for a friend.
In the pictureIn Roblox
Writing the passSocialService:PromptGameInvite with an ExperienceInviteOptions object
The name of the friend who invited youReferredByPlayerId in Player:GetJoinData()
A note on the pass: meet me at the beaconLaunchData, a string of up to 200 characters
The gate reading the passThe server calling GetJoinData in Players.PlayerAdded

See the whole analogy cast

An invite works like a guest pass a player writes out for a friend. The pass names who invited you, and it can carry a short note: meet me at the beacon. When the friend arrives, the gate reads the pass.

Think of it as A guest pass a player writes out for a friend

On the server, the gate is Player:GetJoinData(). It returns a table, and three fields matter here3:

  • ReferredByPlayerId: the user id of the player who invited this one. Roblox fills it for every kind of invite4.
  • LaunchData: the string from ExperienceInviteOptions.LaunchData or a share link.
  • GameJoinContext: how the player joined. A join from an event page or event notification carries EventId5.

Roblox's docs warn that launch data can take a few seconds to appear after the friend joins, and their example re-reads GetJoinData once a second for up to 10 tries1.

How many characters can ExperienceInviteOptions.LaunchData hold?

Answer

200 characters. 200 characters. Keep it to a short tag such as crew or a small JSON object, and look up anything bigger on the server.

Client sideRemember: An invite with LaunchData is a guest pass a player writes out for a friend.

Beacon Yard wants to pay 25 coins to the new player and 25 to the friend who invited them. The first draft pays in PlayerAdded whenever ReferredByPlayerId is not 0. Answer the question below before you open the breakdown.

Where does it break?“A guest pass a player writes out for a friend” is a good picture of an invite with launchdata. Where does it stop being true?

It breaks here. The pass travels in the guest's pocket. Join data comes in with the client, so a pass can be faked, copied or shown again on a second account, and a real gate would keep the stub.

The true model. Roblox fills ReferredByPlayerId and LaunchData from the invite, and the server reads them with GetJoinData. Treat both as hints: pay a referral once per new player and only after real play, save that it was paid in the same profile write as the coins, and cap what one inviter can earn in a day.

What goes wrong if Beacon Yard pays the referral reward in PlayerAdded as soon as ReferredByPlayerId is not 0?

  1. One player can make spare accounts, invite each one, and collect a reward per account without anyone playing a drill
  2. Nothing, because Roblox only fills ReferredByPlayerId for real friends who later play
  3. The reward is lost, because ProfileStore cannot save during PlayerAdded
  4. The invited friend is paid, but the inviter never can be, because they are on another server
Answer

One player can make spare accounts, invite each one, and collect a reward per account without anyone playing a drill. Pay only after proof of play (the friend's first survived drill), once per new player, recorded in the same profile save as the coins, and cap what one inviter earns in a day.

Open this step in lesson mode · Link to this step · This confused me

4A referral that pays once

Roblox's referral page suggests three safeguards: one-time rewards, a cooldown before an inviter can earn again, and watching for unusual activity4. Beacon Yard turns them into one small rule. It returns "none", "wait" or "grant":

  • no referrer, a referrer of 0, or the player's own id: "none";
  • already settled in the profile: "none";
  • a real referral before the friend has survived a drill: "wait";
  • otherwise "grant", and the save that adds the coins also sets referralSettled.

The "wait" case runs again from awardSurvival, next to Analytics.onboarding(player, "SurvivedDrill"). Fix the cell so every test passes.

Luau
local function referralOutcome(inviteeId, referredBy, settled, firstDrillDone)
	-- This draft pays on join, pays self-referrals and pays twice.
	if referredBy ~= nil then
		return "grant"
	end
	return "none"
end
 
print(referralOutcome(200, 100, false, true))
print(referralOutcome(200, 200, false, true))
print(referralOutcome(200, 100, false, false))
print(referralOutcome(200, 100, true, true))
Figure 4.1. Run it in the lesson view or in the Studio command bar. The lesson view checks it with tests.

The inviter may be offline or in another server, so their reward waits under their id in a small data store and is counted when their profile next loads, at most three a day. In Creator Hub, Engagement > Referral Rewards adds a banner to the top of the invite window that describes the reward. Only one banner can be published at a time, and the feature needs a game that has been live for at least a day.

Beacon Yard caps referral rewards at 3 per inviter per day. This inviter already has 2 today (day 20000). What does this print?

local CAP = 3
local state = { day = 20000, count = 2 }
local function credit(today)
	if state.day ~= today then
		state = { day = today, count = 0 }
	end
	if state.count >= CAP then
		return false
	end
	state.count += 1
	return true
end
print(credit(20000), credit(20000), credit(20001))
  1. true false true
  2. true true true
  3. false false true
  4. true false false
Answer

true false true. 2 becomes 3 (allowed), 3 hits the cap (refused), then a new day resets the count to 0 and allows one more.

Open this step in lesson mode · Link to this step · This confused me

5Notifications a player asked for

An experience notification lands in a player's Roblox notification stream with a Join button6. The rules decide what you build:

RuleValue
Who can receive oneOpted-in players aged 13 and over
How oftenOne per player per day from one experience; delivery is not guaranteed
Your game must haveAt least 100 visits, no moderation, and you must be able to manage it
The textA notification string written in Creator Hub (Engagement > Notifications), up to 99 characters, with parameters such as {userId-friend}
SendingFrom a server script with Roblox's Open Cloud package, or from anywhere with an API key

To ask a player to opt in, the client calls ExperienceNotificationService:CanPromptOptInAsync() and then PromptOptIn(). The prompt text is the same in every game, and Roblox skips it for players under 13, players already opted in, and anyone who saw it for your game in the last 30 days. You may not lock gameplay behind opting in.

From outside the game, a Lune script or CI job posts to https://apis.roblox.com/cloud/v2/users/{userId}/notifications with an x-api-key header7:

json
{
  "source": { "universe": "universes/<universe id>" },
  "payload": {
    "message_id": "<notification string id>",
    "type": "MOMENT",
    "parameters": { "userId-friend": { "int64_value": 0 } },
    "join_experience": { "launch_data": "crew" },
    "analytics_data": { "category": "referral" }
  }
}

Which notification string fits Roblox's guidelines for Beacon Yard?

  1. {userId-friend} survived their first drill. Your crew reward is waiting.
  2. Scrap Rush starts in an hour! Join now for double coins!
  3. Important information about your Beacon Yard account. Tap to read.
  4. Turn on notifications to unlock the Shield.
Answer

{userId-friend} survived their first drill. Your crew reward is waiting.. Notifications should be personal and something the player can act on now. Roblox's spam system gives wider reach to notifications that players engage with, so a generic advert also hurts your future reach.

Open this step in lesson mode · Link to this step · This confused me

6Scrap Rush on the game page

At m14-ship, a GitHub Actions workflow switches Scrap Rush on by publishing two Experience Config values:

  workflow_dispatch:
    inputs:
      enabled:
        description: Event on?
        type: boolean
        default: true
      multiplier:
        description: How many times a coin pickup pays (1 to 5)
        type: number
        default: 2
      message:
        description: Note for the config History on the Creator Hub
        type: string
        default: Scrap Rush
Figure 6.1

Players cannot see a config flag. An experience event is what they see. In Creator Hub, Engagement > Events & Updates > Create Event or Update takes a thumbnail, a category, a title, a start and end time, the place to join, and public or private. A game can have at most 10 ongoing or upcoming events. Players click Notify Me and get a notification when the event starts. A public event that started in the last 7 days and has at least 1,000 RSVPs can appear in the Trending Events in Experiences sort5.

Inside the game, the lobby can ask for the RSVP directly. Both calls run on the client, and RSVP only works before the event starts2:

luau
local SocialService = game:GetService("SocialService")
 
local ok, events = pcall(function()
	return SocialService:GetUpcomingExperienceEventsAsync()
end)
if ok then
	for _, event in events do
		if not event.HasStarted and not event.HasEnded then
			SocialService:PromptRsvpToEventAsync(event.Id)
			break
		end
	end
end
Browser
Creator Hub's Create Event form for a test experience, filled in for Scrap Rush: the title, the start and end time, the event place and the privacy set to private.

Select a numbered pin, or a row below, to read what it marks.

Figure 6.2.

The Scrap Rush event form in Creator Hub, saved as private until the event is ready to promote.

Put the steps of a Scrap Rush weekend in order.

  1. Create the Scrap Rush event in Creator Hub as private, with the same start and end times as the plan
  2. Count joins whose GameJoinContext has the event's EventId
  3. Switch the event to public so it shows on the game page with Notify Me
  4. Show the in-game RSVP prompt in the lobby before the start time
  5. At the start time, run the event workflow so scrap_rush turns on in every server
Answer

1. Create the Scrap Rush event in Creator Hub as private, with the same start and end times as the plan 2. Switch the event to public so it shows on the game page with Notify Me 3. Show the in-game RSVP prompt in the lobby before the start time 4. At the start time, run the event workflow so scrap_rush turns on in every server 5. Count joins whose GameJoinContext has the event's EventId. Promote first, collect RSVPs before the start, flip the flag at the start (Roblox notifies everyone who clicked Notify Me), then measure who came from the event.

Open this step in lesson mode · Link to this step · This confused me

7How studios pick their channels

Other ways pros do this

OptionWhat it isWhen pros pick itTrade-offs
Invite promptSocialService:PromptGameInvite with ExperienceInviteOptions and LaunchData.Inside the game, at a natural pause, to bring friends into the same session.Only as good as its timing; a prompt nobody asked for gets closed.
Referral rewardReferredByPlayerId in GetJoinData plus a reward banner in Creator Hub.When the game has a reward worth inviting for and the save to pay it once.Pays for accounts unless it waits for real play and caps each inviter.
Share linkA Creator Hub link with LaunchData, posted anywhere.Off-platform posts, creators and campaigns you want to count.Anyone can copy it, so it counts sources and proves nothing.
Experience notificationOne personal message per player per day, through Open Cloud.Something happened that this player can act on now.Opt-in, 13 and over, not guaranteed, and reach shrinks if players dismiss it.
Experience eventA scheduled event on the game page with Notify Me and in-game RSVP.Timed content such as Scrap Rush, updates and anniversaries.At most 10 ongoing or upcoming; it needs content worth the reminder.

Last week 400 players saw Call your crew, 120 sent an invite, 60 friends joined with LaunchData crew, and 12 of them survived a drill. Which change should the team test first?

  1. Help invited friends through their first drill, for example by spawning them next to the inviter
  2. Show the button to every player every round to raise the 400
  3. Pay the referral on join, so 60 rewards go out instead of 12
  4. Remove the button, because 12 out of 400 is too low to matter
Answer

Help invited friends through their first drill, for example by spawning them next to the inviter. Fix the leakiest step. 30% of shown players invite and half of invites join, but only one in five friends survives a drill.

Open this step in lesson mode · Link to this step · This confused me

8Build along: the social rules

Build along

m14-ship

  • challenges/work/social_rules.luau
  • challenges/social-growth.luau
  1. On a new branch from m14-ship in the game repo, open challenges/work/social_rules.luau and read its five stubs. Sync with Rojo, press Play, and run game.ServerScriptService.RunGameTests:Invoke("social-growth", "social-growth") in the command bar on the server.

    You should see Output shows 15 TEST FAIL lines out of 17 and no pass code.

  2. Write shouldOfferInvite (lost drill, fewer than 2 offers this session, 300 seconds since the last) and referralOutcome (the rule from the Run cell above). Run the command again.

    You should see The four offer_ checks and the five referral_ checks print TEST PASS.

  3. Write creditReferrer (3 per day), notificationBody (the JSON above, nil for bad input or launch data over 200 bytes) and eventToPrompt (the first event that has neither started nor ended). Run the command again.

    You should see All 17 checks print TEST PASS and the Course Runner prints a pass code.

  4. On your published test experience in Creator Hub, open Engagement > Notifications and create a notification string such as {userId-friend} survived their first drill. Your crew reward is waiting.

    You should see The string appears in the Notifications table, and Copy Asset ID gives you its id.

  5. Open Engagement > Events & Updates, create a Scrap Rush event for tomorrow, choose the start place, and set it to private.

    You should see Scrap Rush appears under the Scheduled tab of Events and Updates and does not show on the public game page.

Open this step in lesson mode · Link to this step · This confused me

9Challenges

Level 1, Apprentice

Challenge

Fix referralOutcome in the referral-rule cell so a referral pays once, after real play.

Start from
The game at milestone m14 (download)
Check it here
Run the code cell in the lesson view; the challenge completes when it passes. No Studio needed.

Done means

  • No referrer, a referrer of 0 and a self-referral return none
  • A real referral returns wait until the friend's first drill, then grant
  • A settled referral returns none, and all six assertions in referral-rule pass

Hints

  1. Check the three none cases first, then settled, then firstDrillDone.
  2. referredBy == nil or referredBy == 0 or referredBy == inviteeId covers the first three.
Solution
luau
local function referralOutcome(inviteeId, referredBy, settled, firstDrillDone)
	if referredBy == nil or referredBy == 0 or referredBy == inviteeId or settled then
		return "none"
	end
	if not firstDrillDone then
		return "wait"
	end
	return "grant"
end
 
print(referralOutcome(200, 100, false, true))
print(referralOutcome(200, 200, false, true))
print(referralOutcome(200, 100, false, false))
print(referralOutcome(200, 100, true, true))

Scrap Rush started ten minutes ago. The lobby calls PromptRsvpToEventAsync with its id. What happens?

  1. The call errors, because RSVP only works for events that have not started
  2. The player is added to the RSVP list and notified at the next start
  3. The player is teleported into the event place
  4. Nothing, but the RSVP counts toward the 1,000 needed for Trending Events
Answer

The call errors, because RSVP only works for events that have not started. Check HasStarted first. During the event, a Join Event button or a toast in the game makes more sense than an RSVP.

Level 2, Builder

Challenge

Wire the Call your crew button into your own copy of Beacon Yard and prove a real invite carries its join data.

Start from
m14-ship, on your published test experience

Done means

  • A server module fires a CrewCall remote to players who did not survive the drill
  • The client shows a Call your crew button, and only its click calls CanSendGameInviteAsync and PromptGameInvite with LaunchData crew
  • A second account invited from the prompt joins, and the server prints its ReferredByPlayerId and LaunchData

Hints

  1. awardSurvival already loops over players and checks Humanoid.Health; the players it skips are the ones to ask.
  2. Read GetJoinData a few times, a second apart: launch data can arrive late.
  3. Test the invite in the published game with two real accounts, not in Studio Play.

Level 3, Professional

Challenge

Write the rules that keep Beacon Yard's invites, referrals, notifications and RSVP prompts honest. The test is on the game repo's main branch; run it with game.ServerScriptService.RunGameTests:Invoke("social-growth", "social-growth").

Start from
The game at milestone m14 (download)
Grade it
In Studio, press Play, then run game.ServerScriptService.RunGameTests:Invoke("social-growth") in the server command bar. Copy the pass code from Output.

Done means

  • challenges/work/social_rules.luau offers the invite only after a lost drill, twice a session, 300 seconds apart
  • A referral pays once, after the friend's first drill, never for a self-referral, and an inviter earns at most 3 rewards a day
  • notificationBody builds the Open Cloud body and rejects bad input; eventToPrompt skips running events
  • The social-growth challenge prints TEST PASS for all 17 checks

Hints

  1. Return early for each refusal in shouldOfferInvite: survived, the session cap, then the cooldown.
  2. creditReferrer starts a new record when the stored day is not today.
  3. #launchData counts bytes, which is what the 200-byte limit means.

Open this step in lesson mode · Link to this step · This confused me

10Recap

Retiring the analogy

You no longer need “a guest pass a player writes out for a friend”. Roblox fills ReferredByPlayerId and LaunchData from the invite, and the server reads them with GetJoinData. Treat both as hints: pay a referral once per new player and only after real play, save that it was paid in the same profile write as the coins, and cap what one inviter can earn in a day.

Recap

  1. Ask at a natural pause: Beacon Yard offers Call your crew after a lost drill, and the prompt opens only when the player presses the button.
  2. ReferredByPlayerId and LaunchData arrive with the joining client, so pay a referral once, after a survived drill, saved with the coins, and cap each inviter.
  3. Notifications are opt-in, 13 and over, one a day, and must be personal and actionable; timed content like Scrap Rush goes out as an experience event with Notify Me and in-game RSVP.

An invite with LaunchData is a guest pass a player writes out for a friend, until the pass travels in the guest's pocket. Join data comes in with the client, so a pass can be faked, copied or shown again on a second account, and a real gate would keep the stub.

Next Marketing: thumbnails, ads, community

Open this step in lesson mode · Link to this step · This confused me