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

Can someone check this out my player point script isnt working?

Asked by 9 years ago

Ok i cant get this to work all it does is that nothing i test it with friends (Allowing them to kill me 5 times) and it still doesnt work. Ive also tried to make it so that when you die you have to restart. Example: I have 4 kills no deaths but i die and get one more kill im not supposed to get it. Example 2: I get a 5 kill streak and i get a player point

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,1)
                end
        end)
end)


Answer this question