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

Awardable player points?

Asked by 10 years ago

How do I add awardable player points to a brand new game i created for people to start of with?

2 answers

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
10 years ago

I don't exactly understand your intentions, but to get the total number of Player Points available to be distributed, use the GetAwardablePoints method of the PointsService.

Ad
Log in to vote
0
Answered by
Relatch 550 Moderation Voter
10 years ago

To award playerpoints to a player after killing someone, use this.

print("Currently awardable points : "..game.PointsService:GetAwardablePoints())
game.Players.PlayerAdded:connect(function(plr) 
plr:WaitForChild("leaderstats") 
ks = plr.leaderstats:WaitForChild("Kills") 
local last = ks.Value ks.Changed:connect(function() 
if ks.Value > last then
print("Currently awardable points : "..game.PointsService:GetAwardablePoints())
if game.PointsService:GetAwardablePoints() > 0 then
game.PointsService:AwardPoints(plr.userId,1) 
end
end 
end) 
end)

Now, to show a GUI that shows the amount of playerpoints available, make a gui and put this script inside it. You can also just look in output and check the prints if you don't want to use this.

points = Game:GetService("PointsService")
while true do
    wait(1)
    script.Parent.Text = "There are currently  " ..points:GetAwardablePoints() .. " points left..."
end

Now, to get playerpoints awarded, I suggest making a gui that sells dev products or gamepasses. To create a dev product, go to Configure then click the tab Developer Products then click Create New.

Hope this helped!

Answer this question