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)
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.