Hi Creators,
Last year during RDC, we shared our vision for Party API and how it would empower you to create more connected experiences for users playing together. Today, we’re excited to announce that Party API is live and ready for you to integrate into your creations!
We understand the previous challenges of ensuring Party members can seamlessly play, spawn, and navigate your experiences together. This API directly addresses frustrating scenarios like Party members spawning apart or being split between teams or places.
While Party has already made it easier for users to join an experience together with people they know through features like “Join with Party,” the Party API builds on this by providing you with the PartyData
of users who play together through Roblox’s native Party feature.
This new capability empowers you to build more connected and engaging experiences for your users. Let’s explore how to leverage the Party API to elevate your experience:
Keep Parties Together
Ensure Party members spawn in the same location and seamlessly teleport across places within your experience, maintaining their social togetherness.
This demo video is for illustrative purposes only. See how the Party API keeps members together through unified spawns and seamless teleportation.
Create Exclusive Party Experiences
Design unique in-experience benefits, challenges, or visual elements specifically for users who are part of a Party.
This demo video is for illustrative purposes only. See how you can create exclusive Party experiences, like unlocking unique UGC for purchase, with Party API.
Enhance Team-based Gameplay
Utilize Party information within your matchmaking logic to keep users on the same team, or match similar-sized parties against each other for balanced competition.
How to Integrate Party API
Ready to get started? Here’s how to integrate Party API into your experience and immediately begin enhancing the experience for Party members, leading to more engaged play sessions:
string PartyId (default "")
Add the new PartyId
property to the Player instance a read-only string to identify the party the player currently belongs to. If the player is not in a party, the PartyId
property is set to an empty string.
Example usage:
local Players = game:GetService("Players") for _, player in Players:GetPlayers() do if player.PartyId ~= "" then print(player.DisplayName .. " is in party: " .. player.PartyId) else print(player.DisplayName .. " is NOT in party") end end
[Method] SocialService:GetPlayersByPartyId(partyId)
Use this method to filter all connected players to return only those whose Player.PartyId
matches the provided partyId
. If no players match or an invalid partyId is provided, it returns an empty table.
This behaves similarly to Players:GetPlayers()
, but filters the results to include only those players belonging to the specified party.
Example usage:
local SocialService = game:GetService("SocialService") local Players = game:GetService("Players") Players.PlayerAdded:Connect(function(player) local partyId = player.PartyId if partyId ~= "" then local partyPlayers: { Player } = SocialService:GetPlayersByPartyId(partyId) for _, partyMember in partyPlayers do print("Party Member: " .. partyMember.Name) end else print("Player is not in a party.") end end)
[Method] SocialService:GetPartyAsync(partyId)
Use this API to return the latest PartyData
, an array of PartyMemberData
, associated with the provided partyId
. The returned PartyData
reflects the current state of the party across all active server instances within the experience. The PartyData
array is ordered by the time each Party member accepts the Party invite. This means the first element in the array is the earliest to accept, and the last is the most recent.
You’ll see an error message if the provided partyId
is not a valid GUID. Ensure that the PartyId Player property is not equal to an empty string to avoid this error.
PartyMemberData
Key | Type | Description |
---|---|---|
UserId |
number | The player’s Player.UserId property. |
PlaceId |
number | The DataModel.PlaceId of the place the party member is currently in. |
JobId |
string | The DataModel.JobId of the game server instance the user currently resides in. |
PrivateServerId |
string | (Optional) The DataModel.PrivateServerId is included if the party member is in a private or reserved server. |
ReservedServerAccessCode |
string | (Optional) The ReservedServerAccessCode for the reserved server that the user currently resides in. |
Example usage:
local SocialService = game:GetService("SocialService") local Players = game:GetService("Players") Players.PlayerAdded:Connect(function(player) local partyId = player.PartyId if partyId == "" then warn("Player is not in a party.") return end local success, partyData = pcall(function() return SocialService:GetPartyAsync(partyId) end) if success and partyData then for _, partyMemberData in partyData do print( string.format( [[ Party Member: UserId: %s PlaceId: %s JobId: %s PrivateServerId: %s ReservedServerAccessCode: %s ]], partyMemberData.UserId, partyMemberData.PlaceId, partyMemberData.JobId, partyMemberData.PrivateServerId, partyMemberData.ReservedServerAccessCode ) ) end else warn("Failed to retrieve party data.") end end)
How to Test
At this time, the Party API does not work during playtesting in Roblox Studio. To test aspects of your experience using it, you must publish the experience and run it in the Roblox application. We’re exploring ways to improve the testing experience of this API in Studio in the future.
Start Building With Party API
Party API opens up a new world of connected play on Roblox. We’re excited to see your creative integrations – check out the full documentation below and start building today.
Share your feedback and let us know how you plan to implement the Party API!
The Roblox User Team