PointsService

非推奨を表示

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

作成できません
サービス
非推奨

PointsService クラスはポイントを制御します。

ポイントは、Roblox のプレイヤーの達成と参加を表示するための報酬システムです。このサービスを通じて与えられるポイントは、ゲームの開発者の裁量です。

概要

イベント

  • PointsAwarded(userId : number,pointsAwarded : number,userBalanceInGame : number,userTotalBalance : number):RBXScriptSignal

    プレイヤーにポイントが正常に与えられたときに発動し、プレイヤーが現在のゲームとすべてのゲームで持っている更新されたポイントのバランスを通過します。

プロパティ

方法

イベント

PointsAwarded

このイベントは、プレイヤーにポイントが正常に与えられ、また、プレイヤーが現在のゲームとすべてのゲームで持っている更新されたポイントのバランスを通過するときに発生します。

プレイヤーにポイントが授与されると、以下の例では、ユーザー名とその新しいポイントの残高を印刷します。たとえば、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)

パラメータ

userId: number
pointsAwarded: number
userBalanceInGame: number
userTotalBalance: number

コードサンプル

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.

PointsService.PointsAwarded

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)