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

How do I award points when somebody gets a KO?

I need Help with a script that awards 15 points every KO. I already have points in the server but I don't know how to award them. Please Help!

My Code:


PointsService = game:GetService("PointsService")
Stat = "KOs"
Needed = 1 
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,15) --Change 1 to the amount of points to be awarded each time
                end
        end)
end)

1 answer

I am sorry, but this is not a request site. Please try to code it yourself, and if it does not work, we will help you fix it.

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