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

Want to data save for my scoring system, but it doesn't work?

Asked by 8 years ago

I have tried so many data save methods and NONE of them work for me. Hopefully you guys will be able to help.

01GemsStore = game:GetService("DataStoreService"):GetDataStore("DataStore")
02 
03 
04game.Players.PlayerAdded:connect(function(plr)
05    local stats = Instance.new('Folder', plr)
06    stats.Name = 'leaderstats'
07    local Gems = Instance.new('IntValue', stats)
08    Gems.Name = 'Gems'
09    Gems.Value = GemsStore:GetAsync(plr.UserId) or 0
10 
11    if GemsStore:GetAsync("Points_"..plr.Name) ~= nil then
12        Gems.Value = GemsStore:GetAsync("Points "..plr.Name)
13    else
14        Gems.Value = 0
15        end
View all 21 lines...

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

Should work now. You had SetAsync and GetAsync with different names liek 'points_name' or 'points name' etc. Make sure in your configuration in your place you should have Save API enabled.

01GemsStore = game:GetService("DataStoreService"):GetDataStore("DataStore")
02 
03 
04game.Players.PlayerAdded:connect(function(plr)
05    local stats = Instance.new('Folder', plr)
06    stats.Name = 'leaderstats'
07    local Gems = Instance.new('IntValue', stats)
08    Gems.Name = 'Gems'
09    Gems.Value = GemsStore:GetAsync("Points_"..plr.Name) or 0
10 
11    if GemsStore:GetAsync("Points_"..plr.Name) ~= nil then
12        Gems.Value = GemsStore:GetAsync("Points_"..plr.Name)
13    else
14        Gems.Value = 0
15        end
View all 21 lines...
Ad

Answer this question