Okey, so i made a leaderboard saveing script, but it dosen't work! I've tried literally everything!
Leaderboard Is in game.Players.Localplayer.Leaderstats.Level
This is the script:
game.Players.PlayerRemoving:connect(function(player) local datastore = game:GetService("DataStoreService"):GetDataStore(player.Name.."Stats")
local statstorage = player:FindFirstChild("leaderstats"):GetChildren() for i = 1, #statstorage do datastore:SetAsync(statstorage[i].Name, statstorage[i].Value)
end print("Stats successfully saved") end)
game.Players.PlayerAdded:connect(function(player) local datastore = game:GetService("DataStoreService"):GetDataStore(player.Name.."Stats")
player:WaitForChild("leaderstats")
wait(1)
local stats = player:FindFirstChild("leaderstats"):GetChildren()
for i = 1, #stats do
stats[i].Value = datastore:GetAsync(stats[i].Name)
end
end)
Ty so much if you help me! :-:

2 comments
*..If you helped me!..
Could you put the whole script in the code block, please