PointsService 클래스는 포인트를 제어합니다.
포인트는 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.
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)