script:
local DSService = game:GetService('DataStoreService'):GetDataStore('fakedataSnameforSHcom')
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 = 'Clicks'
-- 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.Clicks.Value}
DSService:SetAsync(uniquekey, Savetable)
end)
credit to AlvinBlox ^, tried to make my own use the DataStore wiki, but that didn't work. His also doesn't work. Does any

3 comments
Capital 'U' in
UserId, also use Connect not connect.Also enabled API services to your game
alivnblox. Thats the issue