Roblox UtilitiesDevlHub Roblox Documentation

Class

PolicyService

NotCreatableServiceNotReplicated
Inherits
Instance › Object
Memory category
Instances

Helps you query information regarding policy compliance for players around the world based on age range, location, and platform type.

PolicyService helps you query information regarding policy compliance for players around the world based on age range, location, and platform type.

Methods 2#

CanViewBrandProjectAsyncDetermines if a user can see brand project assets inside your experience.Yields
GetPolicyInfoForPlayerAsyncReturns policy information about a player based on geolocation, age group, and platform.Yields

CanViewBrandProjectAsync(player: Player, brandProjectId: string): boolean#

Yields

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 LuaGlobals.pcall().

NameTypeDefaultDescription
playerPlayerThe Player object you're trying to show the brand project to.
brandProjectIdstringThe brand project ID provided by Roblox. Represents all assets associated with a brand project.
Returns
  • boolean — Whether or not the brand project can be shown to the specific user.

GetPolicyInfoForPlayerAsync(player: Instance): Dictionary#

Yields

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.
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 player is permitted by policy to use the Photo-to-Avatar API AvatarCreationService:PromptSelectAvatarGenerationImageAsync(). This flag reflects age (for example, users under 13) and regional restrictions, which are evaluated server-side. Check it before calling Photo-to-Avatar APIs to avoid policy-related errors. Note that a true value does not by itself guarantee the prompt will succeed: camera and photo-library availability is checked separately on the player's device, so calls can still fail on platforms where camera access is unavailable.
IsSubjectToChinaPolicies Boolean Any experience that is available in China. When true, an experience should enforce compliance changes. See this forum post for more information.
AllowedExternalLinkReferences Array Not required. This is a legacy field. It always returns an empty array.
IsEndlessContentLoadAllowed Boolean Any experience that includes a feature where content loads automatically and endlessly as the user scrolls, such as a feed, providing an endless flow of media content without requiring the user to engage in any specific interaction such as manual "load more" actions or separate pagination. When true, the player can use features with endless content loading within an experience.
IsEndlessContentAutoplayAllowed Boolean Any experience that contains media content (video or audio) that automatically and endlessly plays without requiring user interaction or initiation, for example clicking a play button. When true, the player can use features within an experience that automatically and endlessly play media content.
Exceptions#

Like any async call, this method needs to be wrapped in LuaGlobals.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 Class.Player instance.
Players not found Internal error that the Class.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 Class.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.

NameTypeDefaultDescription
playerInstanceThe Player to get policy information for.
Returns
  • Dictionary — A dictionary containing information about the policy information of the requested player; see above for the dictionary structure.

Inherited members#

Inherited from Instance 58
Inherited from Object 6
Properties (2)

ClassName, className

Events (1)

Changed