Datastore broken


ENABLE THIS!

Thatā€™s strange. I tested it and it worked for me. Are you sure that you enabled ā€œEnable Studio Access to API Servicesā€ in your game settings?

Already got that enabled ----------

I have that enabled! Am I allowed to send you my game file at all so you can have a look at it?

did you try mine aswell and it didnā€™t work? Maybe itā€™s something related to Uppercase/lowercase as I mentioned earlier

I had a similar problem, where my DataStore wouldnā€™t work for some stats becausue they were lowercased and had a Uppercase Title

coins.Name = "Coins" -- where coins.name is lowercase and has an Uppercase title

Yes. ----------------------------

You copied and past it wrong, here , try this:

local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local SaveDataStore = DataStoreService:GetDataStore("PlayerSave3")

local function SavePlayerData(player)

	local success,errormsg = pcall(function()

		local SaveData = {}

		for i,stats in pairs(player.leaderstats:GetChildren()) do

			SaveData[stats.Name] = stats.Value
		end	
		SaveDataStore:SetAsync(player.UserId,SaveData)
	end)

	if not success then
		return errormsg
	end			
end	

Players.PlayerAdded:Connect(function(player)

	local Stats = Instance.new("Folder")
	Stats.Name = "leaderstats"
	Stats.Parent = player

	local statstime = Instance.new("IntValue")
	statstime.Name = "Time"
	statstime.Parent = Stats

	local rebirths = Instance.new("IntValue")
	rebirths.Name = "Rebirths"
	rebirths.Parent = Stats
	
	local Data = SaveDataStore:GetAsync(player.UserId)

	if Data then

		print("āœ…")

		for i,stats in pairs(Stats:GetChildren()) do

			stats.Value = Data[stats.Name]			
		end			
	else		
		print("āŒ")			
	end
end)

Players.PlayerRemoving:Connect(function(player)

	local errormsg = SavePlayerData(player)
	print("Saved")

	if errormsg then	
		warn(errormsg)		
	end	
end)

game:BindToClose(function()
	for i,player in pairs(Players:GetPlayers()) do	

		local errormsg = SavePlayerData(player)
		if errormsg then
			warn(errormsg)
		end			
	end
	wait(2)	
end)

Redoing it still did not fix it.
image

Wdym? You have to use console to give yourself the data.

and then leave and rejoin and tell me

Go on developer console and say

Uniqetz.leaderstats.Rebirths.Value = 4

I tried doing this, console tells me it tried to index nil with leaderstats

myname.leaderstats.somevalue.Value = 99

I donā€™t because I have a tool in the game where you click it gives you 25 Time

That something elseā€¦ That has nothing to do with datastore. The tool adds value to the stat

Did you try my code tho to see if it works? But switch those Coins/Gems/Aether to your Time and Rebirths

Are you giving the Time on the client or server? (LocalScript or Script)

Can I see the toolsā€™s script, please?