I need to make a leaderboard, but i dont know how to make it so if u join another game u can still have the same points of other games, the thing is that idk if its possible to connect those games and make it so u can still have those points in different games, is there a way?, ik that NRPG Beyond (from Caribbros), have a leaderboard for ranked matches that works in different games, u get teleported to another game and u still have those points.
How do i make a same leaderboard for different games?
1 answer
In my opinion, the best way to store data for players is by using DataStore. You can learn more about that here.
DataStore can save data in different places, but only if they are all in the same game. You can't save data between different games, but the data you save can be accessed from all places in your game. That would be the best way to go, especially if you're considering an RPG. Assuming you already know how to create and set up different places in your games, I'll put an example of a DataStore script below. You can copy this script, but you won't learn anything, which is not the point of this website. If I were you, I would regard this as an example and use it when you get stuck. Refer to the link above and try to do it on your own. One of the best parts of scripting is the satisfaction of a achieving a goal, and you won't get that satisfaction by stealing the work of other people. Good luck!
local DataStore = game:GetService("DataStoreService")
local GoldStore = DataStore:GetDataStore("GoldStore") -- You can call this whatever you want.
game.Players.PlayerAdded:Connect(function(Player)
local Leaderboard = Instance.new("Folder",Player)
local Gold = Instance.new("IntValue",Leaderboard)
Leaderboard.Name = "leaderstats"
Gold.Name = "Gold"
Gold.Value = GoldStore:GetAsync(Player.UserId) or 0
-- The code block above creates a simple leaderboard with gold. Whenever a player joins, their amount of gold is set to either A: The amount of gold saved last time they played or B: zero. The value of Gold will only be zero if the player has never saved a value for gold under their player ID in your game.
Gold.Changed:Connect(function()
GoldStore:SetAsync(Player.UserId, Gold.Value)
end)
-- The code block above makes sure that whenever the player's gold is modified, it saves it to the server.
game.Players.PlayerRemoving:Connect(function(Player)
local Gold = Player.leaderstats.Gold
GoldStore:SetAsync(Player.UserId, Gold.Value)
end)
-- Finally, when a player leaves, their gold is saved once more.
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
The example code is ok but you would need to add a pcall and remove the messy playerremoving and changed events
That's for him/her to do. Like I say above, he/she wouldn't learn anything if I did all the work. I provided a link that he/she can use to make the script suitable to their needs.
Wow thanks
Please accept if it helped. Your welcome.