Data store not working

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 :smiley:

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.

1 Like

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")


local leaderstats ="Folder")

leaderstats.Name = "leaderstats"

leaderstats.Parent = Player

local Clicks="IntValue")

Clicks.Name = "Clicks"

Clicks.Value = 0

Clicks.Parent = leaderstats

local Rebirths="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


print("There Was An Error Saving"..Player.UserId " 's Data :(")




DataStore:SetAsync(Player.UserId, {

["Clicks"] = Player.leaderstats.Clicks.Value;

["Rebirths"] = Player.leaderstats.Rebirths.Value;



You should put them all in the same script. It is easier to do it that way in my opinion.

1 Like

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

1 Like

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.

1 Like

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


local plrkey = plr.UserId
1 Like

oh ok ill try that


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]
  local NumberForSaving = {save1.Value,save2.Value}
1 Like

ok ill test that out thanks a lot btw for the help

and for some reason its still not working ?
here is a image of it

take an ss of the output? also, try putting

local Data,Error = pcall(function()

if Data Then
  save1.Value = GetSaved[1]
  save2.Value = GetSaved[2]
1 Like

idk if this is my plugins or the script