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

How do I add value in my wins leaderboard?

Asked by
Techyfied 114
5 years ago

The leaderboard script is this:

01function CreateStats(NewPlayer)
02    local MainStats = Instance.new("IntValue")
03    MainStats.Name = "leaderstats"
04    MainStats.Value = 0
05    local PointsValue = Instance.new("IntValue")
06    PointsValue.Name = "Wins"
07    PointsValue.Value = 0
08    PointsValue.Parent = MainStats
09    MainStats.Parent = NewPlayer
10    return MainStats
11end
12 
13game.Players.ChildAdded:connect(CreateStats)

And the win giver script is this

1return function(winner)
2 
3end

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

1 answer

Log in to vote
1
Answered by
raid6n 2196 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago
1return function(winner)
2       winner:WaitForChild(“leaderstats”).Wins = winner:WaitForChild(“leaderstats”).MainStats.Wins + 1
3end
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 ('') Techyfied 114 — 5y
0
yeah lol those arent normal quotes royaltoe 5144 — 5y
0
sorry I did it on mobile raid6n 2196 — 5y
Ad

Answer this question