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

how to save a string value with Data Persistance ?[SOLVED]

Asked by 9 years ago

Script in workspace

01function 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 ScoreLoaded2 = player:LoadString("DF")
10                    wait()
11                    if score[i].Name == "DF" then
12                        player.Folder.DF.Value = ScoreLoaded2
13                    end
14                    if ScoreLoaded ~= 0 then
15                        score[i].Value = ScoreLoaded
View all 83 lines...

script in startergui

01player = script.Parent.Parent.Parent
02function 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!"
View all 28 lines...

Answer this question