I've used a ton of Datastore scripts and none of them work like everyone else says they do. I enabled Studio API access, here's the one i've been trying to use now... It just doesn't save or load...
local DSService = game:GetService('DataStoreService'):GetDataStore('189839832983983')
game.Players.PlayerAdded:connect(function(plr)
-- Define variables
local uniquekey = 'id-'..plr.userId
local leaderstats = Instance.new('IntValue', plr)
local savevalue = Instance.new('IntValue')
leaderstats.Name = 'leaderstats'
savevalue.Parent = leaderstats
savevalue.Name = 'Money'
-- GetAsync
local GetSaved = DSService:GetAsync(uniquekey)
if GetSaved then
savevalue.Value = GetSaved[1]
else
local NumbersForSaving = {savevalue.Value}
DSService:SetAsync(uniquekey, NumbersForSaving)
end
end)
game.Players.PlayerRemoving:connect(function(plr)
local uniquekey = 'id-'..plr.userId
local Savetable = {plr.leaderstats.Money.Value}
DSService:SetAsync(uniquekey, Savetable)
end)

1 comment
Don't take alvinbloxx's code and post it here expecting for it to be fixed.