PointsService

Visualizza obsoleti

*Questo contenuto è tradotto usando AI (Beta) e potrebbe contenere errori. Per visualizzare questa pagina in inglese, clicca qui.

Non costruibile
Assistenza
Obsoleto

La classe PointsService controlla i punti.

I punti sono un sistema di premi utilizzato per mostrare le prestazioni e la partecipazione di un Giocatorein tutto Roblox.Come vengono assegnati i punti attraverso questo servizio è a discrezione del sviluppatore del Gioco.

Sommario

Eventi

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

    Si accende quando i punti sono stati assegnati con successo a un Giocatore, mentre viene anche trasmesso l'equilibrio aggiornato dei punti che il giocatore ha nel gioco attuale e in tutti i giochi.

Proprietà

Metodi

Eventi

PointsAwarded

Questo evento si attiva quando i punti sono stati assegnati con successo a un Giocatore, mentre passa anche l'equilibrio aggiornato dei punti che il giocatore ha nel gioco attuale e in tutti i giochi.

Quando a un giocatore vengono assegnati i punti con successo, l'esempio seguente stamperebbe l'ID e il nuovo saldo punti.Se, per esempio, l'account Roblox è stato premiato con trenta punti (e non ne aveva nemmeno uno da cui iniziare)

Utente: 1 ha ora guadagnato 30 (+30) punti nel Giocoattuale, ora facendo il loro saldototale

verrebbe stampata.


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)

Parametri

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

Campioni di codice

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)