Hello
I am making a game and there is a problem with a script that I use all the time.
I am trying to make a new script and trying to find out whats the problem is but it has been 6 hours and it still isn’t saving my leaderboard data.
I really need help on how to save leaderstats data. I tried many many things but none of them works. Even my all settings are open ( Access to Https and API )
this is the script I used :
local ds = game:GetService(“DataStoreService”):GetDataStore(“SaveData”)
game.Players.PlayerAdded:Connect(function(plr)
wait()
local lss = “id_”…plr.userId
local Save1 = plr.leaderstats.Knowledge
local Save2 = plr.leaderstats.Rebirths
local Save3 = plr.leaderstats.Cash
local GetSaved = ds:GetAsync(lss)
if GetSaved then
Save1.Value = GetSaved[1]
Save2.Value = GetSaved[2]
Save3.Value = GetSaved[3]
else
local NumberForSaving = {Save1.Value, Save2.Value, Save3.Value}
ds:GetAsync(lss, NumberForSaving)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
ds:SetAsync(“id_”…plr.userId, {plr.leaderstats.Knowledge.Value, plr.leaderstats.Rebirths.Value, plr.leaderstats.Cash.Value})
end)