Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Will this script work? [Player Points]

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

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.

4 comments

1

Thanks I will make the changes :D, I will vote your answer but I have 0 reputation sorry :(

0

@biocommand , You can make his answer as the correct answer, which gives him 1 rep.

0

@CreativeEnergy I did

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.