Data not saving?

My code is perfectly fine everything was great until i great till I got this error:

HTTP 500 (InternalServerError)

And after that data stopped being updated. And now when I rejoin the game the data loads before that error was there but the new data is not saving.

I can’t help you if we don’t see the code

Okay then my code is:

local SaveClicks = typ:GetDataStore("SaveClicks")
local SaveRebirths = typ:GetDataStore("SaveRebirths")

--[[
	invisible color = tonumber(0x36393e)
]]




players.PlayerAdded:Connect(function(plr)
	local Leaderboard  = Instance.new("Folder", plr)
	Leaderboard.Name = "leaderstats"

	local Clicks = Instance.new("IntValue", Leaderboard)
	Clicks.Name = "Clicks"

	local Rebirths = Instance.new("IntValue", Leaderboard)
	Rebirths.Name = "Rebirths"
	
	local SR = SaveRebirths:GetAsync(plr.UserId)
	local SC = SaveClicks:GetAsync(plr.UserId)
	
	if SC then
		Clicks.Value = SC
	end
	
	if SR then
		Rebirths.Value = SR
	end
end)

players.PlayerRemoving:Connect(function(plr)
	local Clicks = plr.leaderstats.Clicks.Value
	local Rebirths = plr.leaderstats.Rebirths.Value

	SaveClicks:SetAsync(plr.UserId, Clicks)
	SaveRebirths:SetAsync(plr.UserId, Rebirths)
end)

what library is typ? is it referenced? also 500 is usually services down
https://developer.roblox.com/en-us/articles/Datastore-Errors

500 isn’t Service Down, that’s 503, 500 is InternalServerError, and literally look at what is in the parentheses

Thought it was 500, alright yeah I forgot about that lol

“typ” is not library it’s defined argument of

game:GetService("DataStoreService")

Please for the love of code pcall your requests!

Always pcall requests to datastores or httpservice! This should always be done no matter what! (well i guess if you’re using a datastore library like Datstore2 then no because they do that automatically)


Ranting aside your code looks ok although you should condense your data into 1 key so you can reduce your call size. This will lessen the chance of failure.

As for the actual cause of your error - I don’t actually know. 500 is the range of server errors (which means something happened on Roblox’s end - this may or may not be related to your data)

1 Like

Yeah, I had 500 happen to me once from a code bug
@Youtube_Kokyana I believe this thread is a duplicate, search up “roblox datastore code 500” on google

Tried the pcall thing nothing came out no errors nor print thing that should of came out to output, but when i changed the datastores to only 1 datastore and 2 asyncs it just gives me this error:

leadertstats is not a valid member of Player "Players.deivydasma"

You made a typo somewhere - it should be leaderstats

Okay, sorry bout that. But roblox doesn’t want data to be saved for my game like I did all things that you said me to do, and the thing is that it aint’t getting :GetAsync() Input or there is something but I don’t know how to debug it.