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

How do I save values in ReplicatedStorage?

Asked by 7 years ago

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)

0
ReplicatedStorage is only for the current server. DataPresistance is deprecated for security reasons. What do you think is left? hiimgoodpack 2009 — 7y
0
^ Data Store greatneil80 2647 — 7y
0
ok data store.. so do i move all stats to server storage? taunter165 30 — 7y
0
doesn't rlly matter greatneil80 2647 — 7y
View all comments (2 more)
0
just make it a saving string manipulation greatneil80 2647 — 7y
0
and how would i do that? Remember, I'm still a beginner taunter165 30 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

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!

0
that is one and the other is that half the stuff is depricated greatneil80 2647 — 7y
0
thaks dude, but i changed to leaderstats but i tried this and it works, dang spelling.. taunter165 30 — 7y
Ad

Answer this question