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

The Player Point Script I have is not working, am I missing something on that script?

I've been doing researches on my own, yet the only thing Roblox's shows me is a Player Point Script when you JOIN a game

That's the script I added in my place. (Kill a required amount of players to get PP)


PointsService = game:GetService("PointsService")
Stat = "KOs" --Change to the stats name
Needed = 5 --Change to the amount needed to get the playerpoints.
game.Players.PlayerAdded:connect(function(p)
        repeat wait() until p:FindFirstChild("leaderstats") ~= nil
        print("Found \"leaderstats\" object!")
        repeat wait() until p.leaderstats:findFirstChild(Stat) ~= nil
        print("Found "..Stat.." object!")
        p.leaderstats[Stat].Changed:connect(function(prop)
                print("Value changed!")
                if prop >= Needed then
                        game:GetService("PointsService"):AwardPoints(p.userId,10)
                end
        end)
end)

(I did added the linked Leaderboard, and a linked sword.)

And also I did installed the script How many PP are available to get.

local service = game:GetService("PointsService") 

game.Players.PlayerAdded:connect(function(player) 
player:WaitForDataReady() 
service:AwardPoints(500, service:GetAwardablePoints()) 
end) 

Yet it's still not working, and I tried to find some help on YouTube and almost everywhere I could look, I still come with nothing.

Does anyone know what I'm doing wrong?

1 answer

  1. You need to make sure your game has player points. How do you get them? Here's that answer: Is there a player points script?
  2. Script one works fine.
  3. 500 in your second script represents the userId, so you're sending all you awardable points to user with the Id of 500. It should look like:
service:AwardPoints(player.userId, 500)

4 comments

0

+wall142, if I add a different kind of userID code (500) will anyone who completes the objective will get Player Points OR must I write a different code for anyone to get Player Points?

0

No, 'player.userId' represents the player that joins the server. You have to present what the player is or provide a userId. The parameter or numbers '500' represents the amount you're going to give them.

0

So 500 is too much for just one objective. And I almost forgot about this, if I want to make a game pass for my game that is suppose to add Player Points for my game, is that what I must do? (Starter Gui, Add ScreenGui, Add TextButton to Screen Gui, Insert a TextLabel with the info and a *LocalScript?) ~~~(The Local Script) ~~~ local productId = 0 -- change to your T-shirt/gamepass ID! [Enter Spa

0

(Sorry, it cutted) [SCRIPT] local productId = 0 -- change to your T-shirt/gamepass ID! local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() --DONT CHANGE THIS Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId) end)

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