I got the code on leaderstats and for saving it from Harp Seal user. I rewritten it and** it doesn't work**. I have API enabled. I don't know what I could have done wrong.
Here is "Data" script:
local ds = game:GetService("DataStoreService"):GetDataStore("SaveData")
game.Players.PlayerAdded:Connect(function(plr)
wait()
local plrkey = "id_"..plr.UserId
local saves = plr.leaderstats.Money
local Save = ds:GetAsync(plrkey)
if Save then
saves.Value = Save[1]
else
local numbersave = {saves.Value}
ds:GetAsync(plrkey, numbersave)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
ds:GetAsync("id"..plr.UserID, {plr.leaderstats.Money.Value})
end)
And here is save script
local ds = game:GetService("DataStoreService"):GetDataStore("SaveData")
game.Players.PlayerAdded:Connect(function(plr)
wait()
local plrkey = "id_"..plr.UserId
local saves = plr.leaderstats.Money
local Save = ds:GetAsync(plrkey)
if Save then
saves.Value = Save[1]
else
local numbersave = {saves.Value}
ds:GetAsync(plrkey, numbersave)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
ds:GetAsync("id"..plr.UserID, {plr.leaderstats.Money.Value})
end)
Nwm I heard that they have it on the dev forum, can someone compare it or something like that
