Script in workspace
01 | function loada(player) |
02 | if player.DataReady then |
03 | if player then |
04 | wait() |
05 | local score = player.Folder:GetChildren() |
06 | for i = 1 ,#score do |
07 |
08 | local ScoreLoaded = player:LoadNumber(score [ i ] .Name) |
09 | local ScoreLoaded 2 = player:LoadString( "DF" ) |
10 | wait() |
11 | if score [ i ] .Name = = "DF" then |
12 | player.Folder.DF.Value = ScoreLoaded 2 |
13 | end |
14 | if ScoreLoaded ~ = 0 then |
15 | score [ i ] .Value = ScoreLoaded |
script in startergui
01 | player = script.Parent.Parent.Parent |
02 | function save() |
03 | if player.DataReady then |
04 | if player then |
05 | local score = player.Folder:GetChildren() |
06 | for i = 1 ,#score do |
07 | if score [ i ] .ClassName = = "IntValue" then |
08 | player:SaveNumber(score [ i ] .Name,score [ i ] .Value) |
09 | if score [ i ] .Name = = "DF" then |
10 | player:SaveString(score [ i ] .Name,score [ i ] .Value) |
11 | end |
12 | end |
13 | end |
14 | if pcall ( function () player:SaveInstance( "Invent" , player.Inventory) end ) then |
15 | script.Parent.Inventory.Button.Text = "Saved!" |