local DSService = game:GetService('DataStoreService'):GetDataStore('theweirdlolsavedata669')
game.Players.PlayerAdded:connect(function(plr)
local uniquekey = 'id'..plr.userId
local stuff = Instance.new("Folder", plr)
stuff.Name = "stuff"
local Invun = Instance.new('IntValue', stuff)
Invun.Name = "Stat1"
local GetSaved = DSService:GetAsync(uniquekey)
if GetSaved then
Invun.Value = GetSaved[1]
else
local NumbersForSaving = {Invun.Value}
DSService:SetAsync(uniquekey, NumbersForSaving)
end
end)
game.Players.PlayerRemoving:connect(function(plr)
local uniquekey = 'id'..plr.userId
local Savetable = {plr.stuff.Stat1}
DSService:SetAsync(uniquekey, Savetable)
end)
✓ ANSWER ACCEPTED
Why won't this datastore work, nothing saves?
1 answer
✓ Accepted answer
Didn't look too in-depth, however on line 22 you forgot to include ".Value" in the array. If this doesn't solve the problem let me know.
1 comment
1
Works, thank you
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
is this a server script?
yeah, in the workspace