PolicyService
Helps you build gameplay components for compliance.
This class is not replicated. Its interface does not cross the network boundary.
This class is not creatable. Instances of this class cannot be created with Instance.new.
This class is a service. It is a singleton that may be acquired with GetService.
Memory category | Instances |
---|
Member index 5
Description
Important for getting your game to all audiences, PolicyService helps you build gameplay components that can be made compliant with various national regulations for multiple countries. This service is used to query information regarding policy compliance for players around the world based on age range, location, and platform type.
History 13
- 652 Add CanViewBrandProjectAsync
- 553 Change Default of from to Unknown
- 553 Change Default of from to Unknown
- 491 Add GetPolicyInfoForServerRobloxOnlyAsync
- 486 Change ThreadSafety of from ReadOnly to ReadSafe
- 486 Change ThreadSafety of from ReadOnly to ReadSafe
- 462 Change ThreadSafety of GetPolicyInfoForPlayerAsync from to Unsafe
- 462 Change ThreadSafety of from to ReadOnly
- 462 Change ThreadSafety of from to ReadOnly
- 449 Add
- 449 Add
- 402 Add GetPolicyInfoForPlayerAsync
- 402 Add PolicyService
Members 5
CanViewBrandProjectAsync
Parameters (2) | ||
---|---|---|
player | Player | |
brandProjectId | string | |
Returns (1) | ||
bool |
This function yields. It will block the calling thread until completion.
Thread safety | Unsafe |
---|
History 1
GetPolicyInfoForPlayerAsync
Parameters (1) | ||
---|---|---|
player | Instance | |
Returns (1) | ||
Dictionary |
Returns policy information about a player which is based on geolocation, age group, and platform. The structure of the returned dictionary is as follows:
Name | Type | Required for | Description |
---|---|---|---|
AreAdsAllowed | Boolean | Any experience that includes immersive ads | When true, the player might see immersive ads within an experience. |
ArePaidRandomItemsRestricted | Boolean | Any experience that has paid random items | When true, the player cannot interact with paid (via in-experience currency bought with Robux, or Robux directly) random item generators. |
AllowedExternalLinkReferences | Array of strings | Any experience that references external links | A list of external link references (for example, social media links, handles, or iconography) a player is permitted to see. Possible values include: "Discord", "Facebook", "Twitch", "YouTube", "X", "GitHub", and "Guilded". |
IsContentSharingAllowed | Boolean | Any experience that allows users to share content off platform | When true, the player is allowed to share content using APIs which open external sharing flows such as CaptureService:PromptShareCapture(). |
IsEligibleToPurchaseSubscription | Boolean | Any experience that wants to sell subscriptions | When true, the player is eligible to purchase subscriptions within an experience. |
IsPaidItemTradingAllowed | Boolean | Any experience that allows users to purchase virtual items that they can trade with other players | When true, the player can trade virtual items that they purchased with in-experience currency or Robux. |
IsSubjectToChinaPolicies | Boolean | Any experience that is available in China | When true, an experience should enforce compliance changes. See this forum post for more information. |
Exceptions
Like any async call, this needs to be wrapped in a pcall
and
error-handled properly. A full list of possible error messages and their
reasons is as below:
Message | Reason |
---|---|
Instance was not a player | Dev's usage - The parameter is not a Player instance |
Players not found | Internal error - Players object missing |
This method cannot be called on the client for a non-local player | Dev's usage - This method cannot be called on the client for a non-local player |
GetPolicyInfoForPlayerAsync is called too many times | Internal error - GetPolicyInfoForPlayerAsync is called more than 100(current setting) times before http response coming back |
See also:
- LocalizationService:GetCountryRegionForPlayerAsync(), returns country/region code string according to player's client IP geolocation
This function yields. It will block the calling thread until completion.
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of GetPolicyInfoForPlayerAsync from to Unsafe
- 402 Add GetPolicyInfoForPlayerAsync
GetPolicyInfoForServerRobloxOnlyAsync
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Dictionary |
This function yields. It will block the calling thread until completion.
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |