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

converting data persistence to Data stores?

Asked by 9 years ago

question says it all, i have a big game with many players that dont want to lose their data persistence, and for them to lose it would mean losing the players, and losing front page. Ive only found out recently i need data stores to transfer data across multiple places in a universe (i think). so i was wondering if maybe there was a way for when the player enters, load their data persistance, and then save it to data store (without loading it up first)

Data store code i have is here:

01function onPlayerEntered(newPlayer)
02        --Clone Data--
03        local vs = script:WaitForChild("leaderstats"):clone()
04        vs.Parent = newPlayer
05        --Setup Intial Data--
06        local Stats = vs:GetChildren()
07        local S1 = {}
08        for i=1,#Stats do
09            local n = Stats[i].Name
10            S1[n] = Stats[i].Value
11        end
12        --Get Data--
13        if newPlayer.Name ~= "Player" then
14 
15            newPlayer:WaitForDataReady() -- This is the data persistence here;
View all 58 lines...

thanks for any help ~ Bubs

1 answer

Log in to vote
1
Answered by
Edenojack 171
9 years ago

Thats actually what I was thinking. First, check if they have any Data Store saves, if there is nothing there, load up the Data Persistance, and transfer it to a Data Store. Then save that. From that point on, they are seen as having that data and it will no longer search for the old data (Which you don't need to call on.)

Because you may have players return to your game in a few months, it'd be useful to keep this as legacy.

Try it out in a seperate place before you go live though.

0
thanks, i was wondering if you could check the code i added? see what ya think Bubbles5610 217 — 9y
0
I'm still incredibly new to Data storage myself, so unfortunately I won't be much help Edenojack 171 — 9y
Ad

Answer this question