This script used to work for saving/loading data. Now it does not work. As I try to fix it now I cant manage to fix it. I used remote functions but it still does not work. Can someone help me fix the scripts?
Data Save/Load script (SERVERSCRIPTSTORAGE)
function DataLoad(player) wait()-- Change to wait for player longer. player:WaitForDataReady() repeat wait() until player:FindFirstChild("Values") -- Value "The Leaderstat" if player.DataReady then if player:FindFirstChild("Values") then local score = player.Values:GetChildren() for i = 1,#score do local ScoreLoaded = player:LoadNumber(score[i].Name) wait() if ScoreLoaded ~= 0 then score[i].Value = ScoreLoaded end end end end end function DataSave(player) if player:FindFirstChild("Values") then local score = player.Values:GetChildren() for i = 1,#score do player:SaveNumber(score[i].Name,score[i].Value) end end end game.ReplicatedStorage.Events.LoadData.OnServerEvent:Connect(DataLoad) game.ReplicatedStorage.Events.SaveData.OnServerEvent:Connect(DataSave)
Load Data Button SCRIPT (Local Script)
script.Parent.MouseButton1Click:connect(function(plr) game.ReplicatedStorage.Events.LoadData:FireServer(plr) script.Parent.Parent.Parent.Click:Play() end)
Save Data Button SCRIPT (Local Script)
script.Parent.MouseButton1Click:connect(function(plr) game.ReplicatedStorage.Events.SaveData:FireServer(plr) script.Parent.Parent.Parent.Click:Play() end)
If you can help me fix the scripts it is appreciated. I been looking for a fix for 5 hours at this point.
Why are you not using datastores.. ur using playersave which will soon not work.
Use This: http://wiki.roblox.com/index.php?title=Data_store