9 min read

Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.

PolicyService

Inherits from: Instance → Object

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

Inherits from: Instance

Memory category: Instances

Tags: NotCreatable, Service, NotReplicated

Methods

NameType / ReturnsDescription
PolicyService:CanViewBrandProjectAsyncbooleanDetermines if a user can see brand project assets inside your experience.
PolicyService:GetPolicyInfoForPlayerAsyncDictionaryReturns policy information about a player based on geolocation, age group, and platform.

Inherited from Instance

NameType / ReturnsDescription
Instance:AddTag()Applies a tag to the instance.
Instance:childrenInstancesReturns an array of the object's children.
Instance:ClearAllChildren()This method destroys all of an instance's children.
Instance:CloneInstanceCreate a copy of an instance and all its descendants, ignoring instances that are not Archivable.
Instance:cloneInstance
Instance:Destroy()Sets the Instance.Parent property to nil, locks the Instance.Parent property, disconnects all connections, and calls Destroy() on all children.
Instance:destroy()
Instance:FindFirstAncestorInstance?Returns the first ancestor of the Instance whose Instance.Name is equal to the given name.
Instance:FindFirstAncestorOfClassInstance?Returns the first ancestor of the Instance whose Object.ClassName is equal to the given className.
Instance:FindFirstAncestorWhichIsAInstance?Returns the first ancestor of the Instance for whom Object:IsA() returns true for the given className.
Instance:FindFirstChildInstance?Returns the first child of the Instance found with the given name.
Instance:findFirstChildInstance
Instance:FindFirstChildOfClassInstance?Returns the first child of the Instance whose ClassName is equal to the given class name.
Instance:FindFirstChildWhichIsAInstance?Returns the first child of the Instance for whom Object:IsA() returns true for the given className.
Instance:FindFirstDescendantInstance?Returns the first descendant found with the given Instance.Name.
Instance:GetActorActor?Returns the Actor associated with the Instance, if any.
Instance:GetAttributeVariantReturns the value which has been assigned to the given attribute name.
Instance:GetAttributeChangedSignalRBXScriptSignalReturns an event that fires when the given attribute changes.
Instance:GetAttributesDictionaryReturns a dictionary of the instance's attributes.
Instance:GetChildrenInstancesReturns an array containing all of the instance's children.
Instance:getChildrenInstances
Instance:GetDebugIdstringReturns a coded string of the debug ID used internally by Roblox.
Instance:GetDescendantsInstancesReturns an array containing all of the descendants of the instance.
Instance:GetFullNamestringReturns a string describing the instance's ancestry.
Instance:GetStyledVariantReturns the styled or explicitly modified value of the specified property, or else the default property value if it hasn't been styled/modified.
Instance:GetStyledPropertyChangedSignalRBXScriptSignalReturns an event that fires when the given style property changes on the instance.
Instance:GetTagsArrayGets an array of all tags applied to the instance.
Instance:HasTagbooleanCheck whether the instance has a given tag.
Instance:IsAncestorOfbooleanReturns true if an Instance is an ancestor of the given descendant.
Instance:IsDescendantOfbooleanReturns true if an Instance is a descendant of the given ancestor.
Instance:isDescendantOfboolean
Instance:IsPropertyModifiedbooleanReturns true if the value stored in the specified property is not equal to the code-instantiated default.
Instance:QueryDescendantsInstancesReturns an array containing all descendants of the instance that match the selector string.
Instance:Remove()Sets the object's Parent to nil, and does the same for all its descendants.
Instance:remove()
Instance:RemoveTag()Removes a tag from the instance.
Instance:ResetPropertyToDefault()Resets a property to its default value.
Instance:SetAttribute()Sets the attribute with the given name to the given value.
Instance:WaitForChildInstanceReturns the child of the Instance with the given name. If the child does not exist, it will yield the current thread until it does.

Inherited from Object

NameType / ReturnsDescription
Object:GetPropertyChangedSignalRBXScriptSignalGet an event that fires when a given property of the object changes.
Object:IsAbooleanReturns true if an object's class matches or inherits from a given class.
Object:isAboolean

PolicyService:CanViewBrandProjectAsync

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

Parameters

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

TypeDescription
booleanWhether or not the brand project can be shown to the specific user.
FieldValue
tags["Yields"]
securityNone
thread safetyUnsafe
capabilities["Basic"]

Code samples: View on Creator Hub (PolicyService-BrandProjectIntegrationServer, PolicyService-BrandProjectIntegrationClient).

PolicyService:GetPolicyInfoForPlayerAsync

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()`](/docs/avatarcreationservice#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.

Parameters

NameTypeDefaultDescription
playerInstanceThe Player to get policy information for.

Returns

TypeDescription
DictionaryA dictionary containing information about the policy information of the requested player; see above for the dictionary structure.
FieldValue
tags["Yields"]
securityNone
thread safetyUnsafe
capabilities["Basic"]

Code samples: View on Creator Hub (getting-policy-information-for-a-player, getting-policy-for-a-player-for-commerce-products).

Properties

Inherited from Instance

NameType / ReturnsDescription
Instance.ArchivablebooleanDetermines if an Instance and its descendants can be cloned using Instance:Clone(), and can be saved/published.
Instance.archivableboolean
Instance.CapabilitiesSecurityCapabilitiesThe set of capabilities allowed to be used for scripts inside this container.
Instance.IsInSandboxbooleanIndicates whether the instance is inside a sandboxed container.
Instance.NamestringA non-unique identifier of the Instance.
Instance.ParentInstanceDetermines the hierarchical parent of the Instance.
Instance.PredictionModePredictionModeReflects the client-side prediction mode applied to the instance under server-authoritative physics.
Instance.RobloxLockedbooleanA deprecated property that used to protect CoreGui objects.
Instance.SandboxedbooleanWhen enabled, the instance can only access abilities in its Capabilities list.
Instance.UniqueIdUniqueIdA unique identifier for the instance.

Inherited from Object

NameType / ReturnsDescription
Object.ClassNamestringA read-only string representing the class this Object belongs to.
Object.classNamestring

Events

Inherited from Instance

NameType / ReturnsDescription
Instance.AncestryChangedFires when the Instance.Parent property of this object or one of its ancestors is changed.
Instance.AttributeChangedFires whenever an attribute is changed on the Instance.
Instance.ChildAddedFires after an object is parented to this Instance.
Instance.childAdded
Instance.ChildRemovedFires after a child is removed from this Instance.
Instance.DescendantAddedFires after a descendant is added to the Instance.
Instance.DescendantRemovingFires immediately before a descendant of the Instance is removed.
Instance.DestroyingFires immediately before (or is deferred until after) the instance is destroyed via Instance:Destroy().
Instance.StyledPropertiesChangedFires whenever any style property is changed on the instance, including when a property is set to nil.

Inherited from Object

NameType / ReturnsDescription
Object.ChangedFires immediately after a property of the object changes, with some limitations.