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

Data Store script is not saving? [Not Solved]

Asked by 10 years ago

I already know that parts and things such as that cannot be saved in a DataStore! * I am new (Today new) at Data Stores so I'll probably have "newb" mistakes.* I am basically testing DataStores to see if I know how to even do them yet I don't appear to be joining with a change in my Stage . I have 3 scripts, 1 that will save data when you leave, one that uses the data when you join(if any) and the last one that uses OnClose so I can keep the server open when it's suppose to shutdown for Data Saving.

Here's the Added script:

1game.Players.PlayerAdded:connect(function(plr)
2    local DS = game:GetService("DataStoreService"):GetDataStore(plr.Name)
3    plr:WaitForChild("leaderstats"):WaitForChild("Stage")
4    if DS:GetAsync(plr.Name) ~= 0 then
5        plr.leaderstats.Stage.Value = DS:GetAsync(plr.Name)
6    else
7        print(plr.Name.."Doesn't Need Data Transfer")  
8    end
9end)

Here's the Leaving script:

1game.Players.PlayerRemoving:connect(function(plr)
2    local DS = game:GetService("DataStoreService"):GetDataStore(plr.Name)
3    local Key = plr.Name
4    if plr.leaderstats.Value == 0 then
5        print("Ignore Data Save For "..plr.Name)
6    elseif plr.leaderstats.Value >= 1 then
7        DS:SetAsync(Key, plr.leaderstats.Stage.Value)
8    end
9end)

Here's the OnClose script:

1game.OnClose = function()
2    wait(3)
3end

Please don't shy from sharing information so I may better myself in Data Stores.

0
Please stop Posting the Same question. woodengop 1134 — 10y
0
@TheContinentofEurope , There's no rule against a re-post. I also deleted the existing question before this was created. This is only the second time as well. (Take notice of the person who has post the same question 3-4 times just a small rewording once) alphawolvess 1784 — 10y
0
Please stop posting the same question.... NotsoPenguin 705 — 10y
0
It's Technically different. Not talking about an error. Not the same header either alphawolvess 1784 — 10y

1 answer

Log in to vote
1
Answered by 10 years ago

The error you're getting is something almost everyone is getting. Ignore it because it literally has nothing to do with your scripts.

0
Tested what you said, you're right. Although I still have a Data store problem. alphawolvess 1784 — 10y
Ad

Answer this question