PointsService

Show Deprecated
Not Creatable
Service
Deprecated

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.

Summary

Methods

Events

  • 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.

Properties

Methods

AwardPoints

Yields
Deprecated

This function attempts to award the user with the specified Player.UserId the specified number of points.

If successful, this function will return the UserId of the user the points were awarded to, the number of points awarded, the new total number of points the user has in the game and another value which appears to always be 0.

This function will cause an error if the specified UserId is not positive or if the number of points specified is 0.

The function can be used to award a negative number of points to a user however.


local userId, amount, total = game:GetService("PointsService"):AwardPoints(1, 5)
print("The user was awarded " ..amount.. " points. They have now have a total of " ..total.. " points in this game.")

Parameters

userId: number
amount: number

Returns

Code Samples

The below example would attempt to award 5 points to the Roblox account. If the account had been awarded 10 points before, it would print "The user was awarded 5 points. They have now a total of 15 points in this game.".

PointsService:AwardPoints

local PointsService = game:GetService("PointsService")
local userId, amount, total = PointsService:AwardPoints(1, 5)
print("User", userId, "was awarded", amount, "points. They have now have a total of", total, "points in this game.")

GetAwardablePoints

Deprecated

This function returns the number of points the current game has available to award to players.


Returns

GetGamePointBalance

Yields
Deprecated

This function returns the total number of points a player has in the current game.

Parameters

userId: number

Returns

GetPointBalance

Yields
Deprecated

This function returns the total number of points the given player has across all games.

Parameters

userId: number

Returns

Events

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)

Parameters

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

Code Samples

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)