How do I make a +1 tool that ups a leaderstat by 1?
Okay so if you go intro a simulator game and they have a tool that gives u a +1 on a leaderstat.
I would like to know how this is made
If you need here is my leaderstat script & my save data script
[Leaderstat]
01 | game.Players.PlayerAdded:connect( function (player) |
02 | local Leaderstats = Instance.new( "Folder" ) |
03 | Leaderstats.Name = "leaderstats" |
04 | Leaderstats.Parent = player |
06 | local Level = Instance.new( "IntValue" ) |
09 | Level.Parent = Leaderstats |
[Datasave]
01 | function onPlayerEntered(player) |
03 | player:WaitForDataReady() |
04 | repeat wait() until player:FindFirstChild( "leaderstats" ) |
05 | if player.DataReady then |
06 | if player:findFirstChild( "leaderstats" ) then |
07 | local score = player.leaderstats:GetChildren() |
09 | local ScoreLoaded = player:LoadNumber(score [ i ] .Name) |
11 | if ScoreLoaded ~ = 0 then |
12 | score [ i ] .Value = ScoreLoaded |
19 | function onPlayerLeaving(player) |
20 | if player:findFirstChild( "leaderstats" ) then |
21 | local score = player.leaderstats:GetChildren() |
23 | player:SaveNumber(score [ i ] .Name,score [ i ] .Value) |
28 | game.Players.PlayerAdded:connect(onPlayerEntered) |
29 | game.Players.PlayerRemoving:connect(onPlayerLeaving) |