I tried to make it with the local scripting way,doesn't work..
COMMUNITY QUESTION
How can I add a player points system to my game?
2 answers
You should make it in a script not localscript:
-- declare service
local PointsService = Game:GetService("PointsService")
-- Bind function to player added event
game.Players.PlayerAdded:connect(function(player)
-- Get total number of points the game has available
local pointsToAward = PointsService:GetAwardablePoints()
-- Get total number of points this game has already awarded to the player
local universeBalance = PointsService:GetGamePointBalance(player.userId)
-- Check if the game has points to award and if the player hasn't gotten any points yet. If both are true, then give the player a point.
if ( pointsToAward > 0 and universeBalance == 0) then
PointsService:AwardPoints(player.userId, 1)
end
end)
-- Bind function to when points are successfully awarded
PointsService.PointsAwarded:connect(function(userId, userBalanceinUni, userBalance)
-- Show message indicating that a player has gotten points
local message = Instance.new('Message', game.Workspace)
message.Text = "Point awarded to " .. userId .. ". This player now has " .. userBalance .. " points total!"
wait(5)
message:Destroy()
end)
also Thank the roblox wiki.
4 comments
0
Thanks for the advice
0
Np
0
Also accept answer if it helped.
0
v just copied me.
You should make it in a script not localscript:
view source
-- declare service
local PointsService = Game:GetService("PointsService")
-- Bind function to player added event
game.Players.PlayerAdded:connect(function(player)
-- Get total number of points the game has available
local pointsToAward = PointsService:GetAwardablePoints()
-- Get total number of points this game has already awarded to the player
local universeBalance = PointsService:GetGamePointBalance(player.userId)
-- Check if the game has points to award and if the player hasn't gotten any points yet. If both are true, then give the player a point.
if ( pointsToAward > 0 and universeBalance == 0) then
PointsService:AwardPoints(player.userId, 1)
end
end)
-- Bind function to when points are successfully awarded
PointsService.PointsAwarded:connect(function(userId, userBalanceinUni, userBalance)
-- Show message indicating that a player has gotten points
local message = Instance.new('Message', game.Workspace)
message.Text = "Point awarded to " .. userId .. ". This player now has " .. userBalance .. " points total!"
wait(5)
message:Destroy()
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
This isn't a Q&A site where we do it all for you.