I am making a tycoon game, and I am wondering how to make long numbers abbreviated in the leaderboard so that the whole number can be shown on the leaderboard. I have seen this kind of leaderboard in miner's haven and some other games with a money system, so I know it's possible. Here's the script:
local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("CashSaveSystem")
local ds2 = DataStore:GetDataStore("CashPerSecSaveSystem")
game.Players.PlayerAdded:connect(function(player)
local leader = Instance.new("Folder",player)
leader.Name = "leaderstats"
local Cash = Instance.new("NumberValue",leader)
Cash.Name = "Cash"
Cash.Value = ds:GetAsync(player.UserId) or 0
ds:SetAsync(player.UserId, Cash.Value)
Cash.Changed:connect(function()
ds:SetAsync(player.UserId, Cash.Value)
end)
local CashPerSec = Instance.new("NumberValue",leader)
CashPerSec.Name = "Cash Per Second"
CashPerSec.Value = ds2:GetAsync(player.UserId) or 0
ds2:SetAsync(player.UserId, CashPerSec.Value)
CashPerSec.Changed:connect(function()
ds2:SetAsync(player.UserId, CashPerSec.Value)
end)
end)
game.Players.PlayerRemoving:connect(function(player)
ds:SetAsync(player.UserId, player.leaderstats.Cash.Value)
ds2:SetAsync(player.UserId, player.leaderstats.Cash.Value)
end)

3 comments
lmao, you didn't even try, u just gave random code on how to save it...
do you know how to do it?
i didn't think so.