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

Step 1 of 10

A 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")

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
One loop, four Roblox features: an invite prompt, a referral, a notification and, around it all, the Scrap Rush event.
Match the pairs

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

Link to this step · This confused me

Step 2 of 10

The 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.

Choose one

Where should Beacon Yard show the Call your crew button?

Where should Beacon Yard show the Call your crew button?

Press 1 to 4 to choose, Enter to check.

Link to this step · This confused me

Step 3 of 10

Reading 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.

Work it out

How many characters can ExperienceInviteOptions.LaunchData hold?

characters

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.

Choose one

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

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

Press 1 to 4 to choose, Enter to check.

Link to this step · This confused me

Step 4 of 10

A 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
Ctrl Enter runs the cell. Checked by 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.

Predict the output

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))
Beacon Yard caps referral rewards at 3 per inviter per day. This inviter already has 2 today (day 20000). What does this print?

Press 1 to 4 to choose, Enter to check.

Link to this step · This confused me

Step 5 of 10

Notifications 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" }
  }
}
Choose one

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

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

Press 1 to 4 to choose, Enter to check.

Link to this step · This confused me

Step 6 of 10

Scrap 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

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.

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

Put in order

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

Link to this step · This confused me

Step 7 of 10

How 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.
Choose one

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?

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?

Press 1 to 4 to choose, Enter to check.

Link to this step · This confused me

Step 8 of 10

Build 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.

Link to this step · This confused me

Step 9 of 10

Challenges

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; 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
Choose one

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

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

Press 1 to 4 to choose, Enter to check.

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

Meet the criteria above, then record your own result. No test grades this check.

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

The Course Runner prints this code when the test passes.

Link to this step · This confused me

Step 10 of 10

Recap

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

Link to this step · This confused me