How do I add awardable player points to a brand new game i created for people to start of with?
COMMUNITY QUESTION
Awardable player points?
2 answers
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.
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!
This discussion is preserved as it was. New answers, comments, and votes are closed.
