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