Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make it award 1 point on the game leader board every time someone visits my game?

Asked by 7 years ago

I'm not trying to make it award points inside the game, just on the leader board outside the game.

1 answer

Log in to vote
1
Answered by 7 years ago

This code is untested but try this out. Let me know if you get any errors!

01-- declare service
02local PointsService = Game:GetService("PointsService")
03 
04-- Bind function to player added event
05game.Players.PlayerAdded:connect(function(player)
06    -- Get total number of points this game has already awarded to the player
07    local universeBalance = PointsService:GetGamePointBalance(player.userId)
08    -- Check if the player hasn't gotten any points yet. If true, award the points.
09    if ( universeBalance == 0) then
10        PointsService:AwardPoints(player.userId, 1)
11    end
12end)
13 
14-- Bind function to when points are successfully awarded
15PointsService.PointsAwarded:connect(function(userId, userBalanceinUni, userBalance)
View all 22 lines...
0
I just want it to award points every time someone visits my game secretly so i can see how many times they've visited, Also i'm getting an error on line 10. QuantumScripter 48 — 7y
0
It's not posting to the leader board but it is rewarding me 1 point. QuantumScripter 48 — 7y
Ad

Answer this question