I'm trying to make a save script for my game. The values(stats) are in replicated storage. I'm still a beginner intermediate scripter so I only know about saving leaderstats. I need some help with making a save script. I tried editing a data persistence script but it didn't work.
function onPlayerEntered(player) wait()-- Change to wait for player longer. player:WaitForDataReady() repeat wait() until game.ReplicatedStoarage.StatsFolder:FindFirstChild(player.Name).Muscle.Value if player.DataReady then if player:findFirstChild("leaderstats") then local score = game.ReplicatedStoarage.StatsFolder:FindFirstChild(player.Name).Muscle.Value 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 onPlayerLeaving(player) if game.ReplicatedStorage:findFirstChild("StatsFolder") then local score = game.ReplicatedStoarage.StatsFolder:FindFirstChild(player.Name).Muscle.Value for i = 1,#score do player:SaveNumber(score[i].Name,score[i].Value) end end end game.Players.PlayerAdded:connect(onPlayerEntered) game.Players.PlayerRemoving:connect(onPlayerLeaving)
Well, I'm no expert, but you spelled storage wrong which might be the issue.
You spelled it: "ReplicatedStoarage"
The correct spelling: "ReplicatedStorage"
If this doesn't help I'm sorry for being useless, good luck!