Hello, so currently I just started making a simulator game and came across an issue. When I try to display my leaderstat it shows 20000 instead of 20k. I did some research and found out I need to make it Abbreviate or something along the lines. Im not sure how I would rewrite my code for that or if I even need to. I assume all I need to do is put a local script in the text label, get the leaderstat and abbreviate it. If you can respond to this topic, could you go into studio and try to find a way, then copy and paste the code. Next to the lines if you can put how and why your code works so I can better understand what it means. Thank you for reading this and have a great rest of your day!
Leaderstat
game.Players.PlayerAdded:Connect(function(Player)
local Leaderstats = Instance.new("Folder")
Leaderstats.Name = "leaderstats"
Leaderstats.Parent = Player
local Coins = Instance.new("IntValue")
Coins.Name = "Coins"
Coins.Parent = Leaderstats
local Strength = Instance.new("IntValue")
Strength.Name = "Strength"
Strength.Parent = Leaderstats
local Rebirths = Instance.new("IntValue")
Rebirths.Name = "Water"
Rebirths.Parent = Leaderstats
local CoinsData
local StrengthData
local RebirthsData
local Success, ErrorMessage = pcall(function()
CoinsData = DataStore:GetAsync(Player.UserId.."-CashData")
StrengthData = DataStore:GetAsync(Player.UserId.."-PointsData")
RebirthsData = DataStore:GetAsync(Player.UserId.."-RebirthsData")
end)
if not Success then
print(ErrorMessage)
end
if CoinsData ~= nil then
Coins.Value = CoinsData
else
Coins.Value = 0
end
if StrengthData ~= nil then
Strength.Value = StrengthData
else
Strength.Value = 0
end
if RebirthsData ~= nil then
Strength.Value = RebirthsData
else
Strength.Value = 0
end
end)
game.Players.PlayerRemoving:Connect(function(Player)
pcall(function()
DataStore:SetAsync(Player.UserId.."-CashData", Player.leaderstats.Coins.Value)
DataStore:SetAsync(Player.UserId.."-PointsData", Player.leaderstats.Strength.Value)
DataStore:SetAsync(Player.UserId.."-RebirthsData", Player.leaderstats.Rebirths.Value)
end)
end)```