so i made a data and i tried to fix every thing in the code but it just wont save for some reason here is a image of it
here is also a image off the leader stats if u need it
thanks for reading

so i made a data and i tried to fix every thing in the code but it just wont save for some reason here is a image of it
Were there any errors? If you haven’t already done this, go to Home > Game settings > Security > Allow studio access to api services. You might have to wait a few hours after you do this for it to work, but that might just be me.
i fixed the errors and i just activated api ill wait like a few hours for it to see if it works thanks a lot for the help
The script under this is what i use, its more simple (in my opinion) and has never failed me (lol) i noticed you already got help, but if that doesnt work you can try this.
Hope it helps even if u dont need it/use it!
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("MoneyStats")
game.Players.PlayerAdded:Connect(function(Player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = Player
local Clicks= Instance.new("IntValue")
Clicks.Name = "Clicks"
Clicks.Value = 0
Clicks.Parent = leaderstats
local Rebirths= Instance.new("IntValue")
Rebirths.Name = "Rebirths"
Rebirths.Value = 0
Rebirths.Parent = leaderstats
local Data = DataStore:GetAsync(Player.UserId)
if Data then
Clicks.Value = Data.Clicks
Rebirths.Value = Data.Rebirths
else
print("There Was An Error Saving"..Player.UserId " 's Data :(")
end
end)
game.Players.PlayerRemoving:Connect(function(Player)
DataStore:SetAsync(Player.UserId, {
["Clicks"] = Player.leaderstats.Clicks.Value;
["Rebirths"] = Player.leaderstats.Rebirths.Value;
})
end)
You should put them all in the same script. It is easier to do it that way in my opinion.
yeah same, it feels un-organized and weird when you do it in 2 or more
oh ok thanks a lot dude ill try it now
It’s a simple fix you forget the capitalisation on userid, it’s ‘plr.UserId’ not ‘plr.userid’. Don’t let others tell you how to organise your script either.
i just tryed the new script that TK proveded it it seems to not work ? i didnt get eny error or eny thing so i dont know what to do
ill try wat u said akit one sec
change the plrkey from
local plrkey = plr.userid
to
local plrkey = plr.UserId
oh ok ill try that
(char123120)
no still ?? it still doesnt seem to work ?
i just tested it now on a main game on roblox and for some reason its still not working ?
idk if it might be bc of the way the clicks button is coded it also has a effect that pops up
if GetSaved then
save1.Value = GetSaved[1]
save2.Value = GetSaved[2]
else
local NumberForSaving = {save1.Value,save2.Value}
ds:SetAsync(plrkey,NumberForSaving)
end
ok ill test that out thanks a lot btw for the help
take an ss of the output? also, try putting
local Data,Error = pcall(function()
ds:GetAsync(plrkey)
end)
if Data Then
print("DataLoaded")
save1.Value = GetSaved[1]
save2.Value = GetSaved[2]
else
print(Error)
end