so I tried making a save leaderboard script and it didnt work any help?
local serverStorage = game:GetService("ServerStorage")
local DataStore = game:GetService("DataStoreService"):GetDataStore("leaderstats")
game.Players.PlayerAdded:connect(function(player)
local Leaderstats = Instance.new("Folder", player)
Leaderstats.Name = "leaderstats"
local Size = Instance.new("IntValue", Leaderstats)
Size.Name = "Size"
Size.Value = 1
local Rebirths= Instance.new("IntValue", Leaderstats)
Rebirths.Name = "Rebirths"
Rebirths.Value = 0
local SizeData, RebirthsData
local success, errormessaage = pcall(function()
SizeData = DataStore:GetAsync("size-"..player.UserId)
RebirthsData = DataStore:GetAsync("rebirths-"..player.UserId)
end)
if success then
if SizeData then
Size.Value = SizeData
Rebirths.Value = RebirthsData
end
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local success, errormessage = pcall(function()
DataStore:GetAsync("size"..player.UserId,player.leaderstats.Size.Value)
DataStore:GetAsync("rebirths"..player.UserId,player.leaderstats.Rebirths.Value)
end)
end)

1 comment
Um I am really confused this still wont work.