This is a yielding function. When called, it will pause the Lua thread that called the function until a result is ready to be returned, without interrupting other scripts.
This function was once part of the
PointService class used to control an ancient achievement system since removed and deprecated. It should not be used in new work.
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.")
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.”.