Log in to vote

This thing wants everything to be in question format?

Asked by 6 years ago

How do you add Player Points? I've heard of it but never used it. How can you give player points to people playing your game or buying a shirt form your shop or stuff. Also, is it possible to give yourself player points?

1 answer

Log in to vote
Answered by 6 years ago

This code here automatically gives the player playerpoints when joining a game.

-- declare service
local PointsService = Game:GetService("PointsService")

-- Bind function to player added event
    -- Get total number of points the game has available
    local pointsToAward = PointsService:GetAwardablePoints()
    -- Get total number of points this game has already awarded to the player
    local universeBalance = PointsService:GetGamePointBalance(player.userId)
    -- Check if the game has points to award and if the player hasn't gotten any points yet. If both are true, then give the player a point.
    if ( pointsToAward > 0 and universeBalance == 0) then
        PointsService:AwardPoints(player.userId, 1)

-- Bind function to when points are successfully awarded
PointsService.PointsAwarded:connect(function(userId, userBalanceinUni, userBalance)
    -- Show message indicating that a player has gotten points
    local message ='Message', game.Workspace)
    message.Text = "Point awarded to " .. userId .. ". This player now has " .. userBalance .. " points total!"

Also, I think you can give points to yourself but A. I am unsure B. That's not really the point of them...

For more info, check out these links:


Answer this question