Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I save values in ReplicatedStorage?

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)

6 comments

0

ReplicatedStorage is only for the current server. DataPresistance is deprecated for security reasons. What do you think is left?

0

^ Data Store

0

ok data store.. so do i move all stats to server storage?

0

doesn't rlly matter

0

just make it a saving string manipulation

0

and how would i do that? Remember, I'm still a beginner

1 answer

✓ Accepted answer

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!

2 comments

0

that is one and the other is that half the stuff is depricated

0

thaks dude, but i changed to leaderstats but i tried this and it works, dang spelling..

This discussion is preserved as it was. New answers, comments, and votes are closed.