I have different ROBLOX places connected through one game, and I would like to know how to keep the leaderboard stats of players in the different games.
Thank you.
As long as you already have a leaderboard script that sets up the leaderboard in each game, this will carry the leaderboard data to each one. So just make sure that each place has a 1- a leaderboard script, 2- this script. Tell me if you have any problems.
--[[Savin' Dem Stats --]] 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) print("saved data number "..i) end print("Stats successfully saved") end) --[[ Loadin' Dem Stats --]] 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) print("stat numba "..i.." has been found") end end)