PolicyService

Show Deprecated
Not Creatable
Service
Not Replicated

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

Summary

Methods

Properties

Methods

CanViewBrandProjectAsync

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

Parameters

player: Player

The Player object you're trying to show the brand project to.

brandProjectId: string

The brand project ID provided by Roblox. Represents all assets associated with a brand project.


Returns

Whether or not the brand project can be shown to the specific user.

Code Samples

You must call CanViewBrandProjectAsync from the server-side and then fire an event on the client. Calling this method from the client-side returns an error.

Server-side code sample

-- In ServerScriptService
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PolicyService = game:GetService("PolicyService")
-- Pre-created RemoteEvent in ReplicatedStorage
local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")
local brandedAsset = ReplicatedStorage:WaitForChild("BrandedAsset")
local defaultAsset = Instance.new("Part")
Players.PlayerAdded:Connect(function(player)
-- PolicyService:CanViewBrandProjectAsync can only be called from the Server
local success, canView = pcall(function()
return PolicyService:CanViewBrandProjectAsync(player, "BRP-0123456789")
end)
if success and canView then
RemoteEvent:FireClient(player, brandedAsset)
else
RemoteEvent:FireClient(player, defaultAsset)
end
end)
Client-side code sample

-- In StarterPlayerScripts
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-- Pre-created RemoteEvent in ReplicatedStorage
local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")
RemoteEvent.OnClientEvent:Connect(function(partToLoad)
local clonedPart = partToLoad:Clone()
clonedPart.Parent = workspace
end)

GetPolicyInfoForPlayerAsync

Yields

Returns policy information about a player based on geolocation, age group, and platform. The structure of the returned dictionary is as follows:

NameTypeRequired forDescription
AreAdsAllowedBooleanAny experience that includes immersive ads.When true, the player might see immersive ads within an experience.
ArePaidRandomItemsRestrictedBooleanAny 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.
AllowedExternalLinkReferencesArrayAny 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".
IsContentSharingAllowedBooleanAny 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 PromptShareCapture().
IsEligibleToPurchaseSubscriptionBooleanAny experience that wants to sell subscriptions.When true, the player is eligible to purchase subscriptions within an experience.
IsPaidItemTradingAllowedBooleanAny 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.
IsSubjectToChinaPoliciesBooleanAny 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:

MessageReason
Instance was not a playerThe player parameter is not a Player instance.
Players not foundInternal error that the Players object is missing.
This method cannot be called on the client for a non-local playerThis method cannot be called on the client for a non-local Player.
GetPolicyInfoForPlayerAsync is called too many timesInternal 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

player: Instance

The Player to get policy information for.


Returns

A dictionary containing information about the policy information of the requested player; see above for the dictionary structure.

Code Samples

This code sample gets policy information for the local player and warns if they cannot interact with paid random item generators.

Getting Policy Information for a Player

local PolicyService = game:GetService("PolicyService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local success, result = pcall(function()
return PolicyService:GetPolicyInfoForPlayerAsync(player)
end)
if not success then
warn("PolicyService error: " .. result)
elseif result.ArePaidRandomItemsRestricted then
warn("Player cannot interact with paid random item generators")
end

Events