I am making a tower defense game and using profile store for the main data saving system but I want to make global leaderboards, i know that profile store doesn’t support global leaderboards, but is there any other way I could get around this without recoding a new data saving system?
1 Like
you can use the profile store to save the data but then make your own orded data store in the data store the update the order data store every 5 minutes for example
-- make your own code to get the leaderboard data upon joining
local DDS = game:GetSerivce("DataStoreSerivce")
local Players = game:GetSerivce("Players")
local CoinsDataStore = DDS:GetOrdedDataStore("CoinsData")
local REFRESH_TIME = 60 * 5 -- 5 minutes
function Refresh(Player: Player)
while task.wait(REFRESH_TIME) do
if not Players:FindFirstChild(Player.Name) then break end
-- Amuning you have your item in a value under leaderstats
local PlayerCoins = Player.leaderstats.Coins.Value
local Attempts = 1
local success, err
repeat
success, err = pcall(function()
CoinsDataStore:SetAsync(Player.UserId, PlayerCoins)
end)
if not success then
Attempts += 1
print(err)
task.wait(3)
end
until success or Attempts == 5
if success then
print("Successfully added data")
else
print("No Success", err
end
end
end
Players.PlayerAdded:Connect(function(Player)
Refresh(Player)
end)
sorry that isn’t formatted correctly I wrote this off by heart so it might not be correct ether
if you don’t know how to make the leaderboard I can show you a video I used to make my first one.
2 Likes
SCP - Mineral Mining Company ahh naming.
How come DDS referance DSS? ![]()
Just use service auto complete plugin vro
![]()
https://create.roblox.com/store/asset/11380642657
or
https://create.roblox.com/store/asset/84725827043434
2 Likes
I just did that because I was typing on a computer but not on roblox studio because I wasn’t there. I usually don’t do it like that. The - was a typo.