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

How do I add value in my wins leaderboard?

The leaderboard script is this:

function CreateStats(NewPlayer)
    local MainStats = Instance.new("IntValue")
    MainStats.Name = "leaderstats"
    MainStats.Value = 0
    local PointsValue = Instance.new("IntValue")
    PointsValue.Name = "Wins"
    PointsValue.Value = 0
    PointsValue.Parent = MainStats
    MainStats.Parent = NewPlayer
    return MainStats
end

game.Players.ChildAdded:connect(CreateStats)

And the win giver script is this

return function(winner)
       
end

What do i have to put in the second line so a player gets 1 win if they win a game?

1 answer

✓ Accepted answer

return function(winner)
       winner:WaitForChild(“leaderstats”).Wins = winner:WaitForChild(“leaderstats”).MainStats.Wins + 1
end

3 comments

0

This worked, but i had to change a bit to work. the bracket ("") is not like this. It worked when i made it this ('')

0

yeah lol those arent normal quotes

0

sorry I did it on mobile

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