PointsService
*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。
ポイントサービスクラスは、ポイントを制御します。
ポイントは、Roblox 全体でプレイヤーの成果と参加を表示するために使用される報酬システムです。このサービスを通じて付与されるポイントの方法は、ゲームの開発者の判断に任されています。
概要
イベント
- PointsAwarded(userId : number,pointsAwarded : number,userBalanceInGame : number,userTotalBalance : number):RBXScriptSignal
ポイントがプレイヤーに成功して付与されたときに発火し、現在のゲームとすべてのゲームの更新されたポイントのバランスを通過します。
プロパティ
方法
イベント
PointsAwarded
このイベントは、ポイントがプレイヤーに成功裏に授与され、現在のゲームとすべてのゲームの更新されたポイントバランスを通過したときに発動します。
プレイヤーにポイントが正常に付与されると、以下の例では、ユーザーIDと新しいポイントバランスが印刷されます。たとえば、Roblox アカウントが 30 ポイント授与された場合 (最初から何もなかった)
ユーザー: 1 は現在のゲームで 30 (+30) ポイントを獲得し、合計残高を作成しています
印刷されます。
local function pointsAwarded(userId, pointsAwarded, userBalanceInGame, userTotalBalance)
print("User: " .. userId .. " has now earned " .. userBalanceInGame .. " (+" .. pointsAwarded ..") points in the current game, now making their total balance " .. userTotalBalance)
end
game:GetService("PointsService").PointsAwarded:Connect(pointsAwarded)
パラメータ
コードサンプル
When a player is awarded points successfully the below example would print the userId and their new point balance. If, for example, the Roblox account was awarded thirty points (and had none to begin with) "User: 1 has now earned 30 (+30) points in the current game, now making their total balance 30" would be printed.
local PointsService = game:GetService("PointsService")
local function onPointsAwarded(userId, pointsAwarded, userBalanceInGame, userTotalBalance)
print(
"User:",
userId,
"has now earned",
userBalanceInGame,
"(+",
pointsAwarded,
") points in the current game, now making their total balance",
userTotalBalance
)
end
PointsService.PointsAwarded:Connect(onPointsAwarded)