PointsService

사용되지 않는 항목 표시
만들 수 없음
서비스
더 이상 사용되지 않음

The PointsService class controls points.

Points are an award system used to showcase a player's achievements and participation throughout Roblox. How points are awarded through this service is at the discretion of the game's developer.

요약

이벤트

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

    Fires when points have been successfully awarded to a player, while also passing along the updated balance of points the player has in the current game and all games.

속성

메서드

이벤트

PointsAwarded

This event fires when points have been successfully awarded to a player, while also passing along the updated balance of points the player has in the current game and all games.

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

would be printed.


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

코드 샘플

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)