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

Will this script work? [Player Points]

Asked by 10 years ago

Before spending 100rs on a gamepass can someone please tell me if this script works?

local service = game:GetService("PointsService") 

game.Players.PlayerAdded:connect(function(player) 
player:WaitForDataReady() 
service:AwardPoints(GamepassIDHere, service:GetAwardablePoints()) 
end) 

1 answer

Log in to vote
4
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

No. The first parameter to AwardPoints is the userId, not the ID of a gamepass.

service:AwardPoints(player.userId, service:GetAwardablePoints())

This will occur unconditionally though, regardless of the gamepass purchase. You need to check in an if whether or not the player owns the gamepass.

Also note that if a player purchases the game pass, and another player who bought the game pass joins before they do, that player will receive all of the points and the player who joins second will get none.

EDIT: The solution to the last problem I noted is to award the amount for purchasing a gamepass, and store that it has been awarded so that future visits don't attract random bonuses either.

1
Thanks I will make the changes :D, I will vote your answer but I have 0 reputation sorry :( biocommand 30 — 10y
0
@biocommand , You can make his answer as the correct answer, which gives him 1 rep. AmericanStripes 610 — 10y
0
@CreativeEnergy I did biocommand 30 — 10y
0
If it was marked as accepted, there would be a green check mark next to it (Just letting you know -- I don't really care about the points), so if you did, it didn't get saved right. BlueTaslem 18071 — 10y
Ad

Answer this question