学ぶ
エンジンクラス
PolicyService
作成できません
サービス
複製されていません

*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。


概要
継承されたメンバー

APIリファレンス
方法
CanViewBrandProjectAsync
イールド
機能: Basic
PolicyService:CanViewBrandProjectAsync(
player:Player, brandProjectId:string
パラメータ
player:Player
brandProjectId:string
戻り値
コードサンプル
サーバー側のコードサンプル
-- ServerScriptService内
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PolicyService = game:GetService("PolicyService")
-- ReplicatedStorage内に事前に作成されたRemoteEvent
local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")
local brandedAsset = ReplicatedStorage:WaitForChild("BrandedAsset")
local defaultAsset = Instance.new("Part")
Players.PlayerAdded:Connect(function(player)
-- PolicyService:CanViewBrandProjectAsyncはサーバーからのみ呼び出すことができます
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)
クライアント側のコードサンプル
-- StarterPlayerScripts内で
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-- ReplicatedStorageに事前作成されたRemoteEvent
local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")
RemoteEvent.OnClientEvent:Connect(function(partToLoad)
local clonedPart = partToLoad:Clone()
clonedPart.Parent = workspace
end)

GetPolicyInfoForPlayerAsync
イールド
機能: Basic
PolicyService:GetPolicyInfoForPlayerAsync(player:Instance):Dictionary
パラメータ
player:Instance
戻り値
コードサンプル
プレイヤーのポリシー情報の取得
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 エラー: " .. result)
elseif result.ArePaidRandomItemsRestricted then
warn("プレイヤーは有料のランダムアイテムジェネレーターと対話できません")
end
プレイヤーのポリシー情報を取得する
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 エラー: " .. result)
elseif not result.IsEligibleToPurchaseCommerceProduct then
warn("プレイヤーは商取引製品を購入する資格がありません")
end

©2026 Roblox Corporation。Roblox(ロブロックス)、RobloxロゴおよびPowering Imaginationは、米国並びにその他の国における登録商標および非登録商標です。