PolicyService
Helps you query information regarding policy compliance for players around the world based on age range, location, and platform type.
| Memory category | Instances |
|---|
Member index 5
Description
PolicyService helps you 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 | ||
Determines if a user can see brand project assets inside your experience. This method lets you work with brands to only show commercial assets to brand-compliant audiences.
To use CanViewBrandProjectAsync, you must use a brand project ID
provided by Roblox. To request a brand project ID,
contact
us.
You must call this method on a server-side Script and wrap it in a pcall().
| Thread safety | Unsafe |
|---|
History 1
GetPolicyInfoForPlayerAsync
| Parameters (1) | ||
|---|---|---|
| player | Instance | |
| Returns (1) | ||
| Dictionary | ||
Returns policy information about a player 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 can not interact with paid random item generators, either via in‑experience currency bought with Robux or Robux directly. |
AllowedExternalLinkReferences | Array | Any experience that references external links. | A list of external link references such as social media links, handles, or iconography that a player is permitted to see. Possible values include "Discord", "Facebook", "Twitch", "YouTube", "X", "GitHub", and "Guilded". |
IsContentSharingAllowed | Boolean | Any feature in the experience that enables users to create content (e.g. text, images, video, audio) that other users can see in the experience or allows user to share content within experiences. | When true, the player can use features related to sharing UGC within an experience, such as uploading a screen capture, sharing a video, or posting an image to a content feed that other users can see. |
IsEligibleToPurchaseCommerceProduct | Boolean | Any experience that wants to sell commerce products. | When true, the player is eligible to purchase commerce products within an experience. |
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. |
IsPhotoToAvatarAllowed | Boolean | Any experience that uses the Photo-to-Avatar APIs. | When true, the Photo-to-Avatar API `Class.AvatarCreationService: PromptSelectAvatarGenerationImageAsync()` is available to the player. |
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 method needs to be wrapped in pcall() and error-handled properly. A full list of possible error messages and their reasons is:
| Message | Reason |
|---|---|
| Instance was not a player | The player parameter is not a Player instance. |
| Players not found | Internal error that the Players object is missing. |
| This method cannot be called on the client for a non-local player | This method cannot be called on the client for a non-local Player. |
| GetPolicyInfoForPlayerAsync is called too many times | Internal error that GetPolicyInfoForPlayerAsync() is called more than 100 (current setting) times before an HTTP response comes back. |
See also LocalizationService:GetCountryRegionForPlayerAsync() which returns a country/region code string according to the player's client IP geolocation.
| Thread safety | Unsafe |
|---|
History 2
- 462 Change ThreadSafety of GetPolicyInfoForPlayerAsync from to Unsafe
- 402 Add GetPolicyInfoForPlayerAsync
GetPolicyInfoForServerRobloxOnlyAsync
| Parameters (0) | ||
|---|---|---|
| No parameters. | ||
| Returns (1) | ||
| Dictionary | ||
| Security | RobloxScriptSecurity |
|---|---|
| Thread safety | Unsafe |