local ds = game:GetService("DataStoreService"):GetDataStore("--Cash01")
game.Players.PlayerAdded:Connect(function(player)
local key = "cash-"..player.UserId
local folder = Instance.new("Folder") -- # parent objects last for better performance
folder.Name = "leaderstats"
folder.Parent = player
local currency = Instance.new("IntValue")
currency.Name = "Coins"
currency.Value = ds:GetAsync(key) -- # defaults to 0 if there isn't any data
currency.Parent = folder
local fake1 = Instance.new("StringValue")
fake1.Name = currency.Name
fake1.Value = tostring(currency.Value)
fake1.Parent = folder
currency.Changed:Connect(function()
local x = tostring(currency.Value)
if #x >= 10 then -- Billions
fake1.Value = x:sub(0,(#x-9)).."."..(x:sub(#x-7,(#x-7))).."B+"
elseif #x >= 7 then -- Millions
fake1.Value = x:sub(0,(#x-6)).."."..(x:sub(#x-5,(#x-5))).."M+"
elseif #x >= 4 then -- Thousands
fake1.Value = x:sub(0,(#x-3)).."."..(x:sub(#x-2,(#x-2))).."K+"
else -- If it's not high enough...
fake1.Value = tostring(currency.Value)
end
end)
end)
COMMUNITY QUESTION
Code won't save data or abbreviate, already fixed once, please help?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
I can't figure out why this won't work.
I have tried it both in studio and not, but neither times will it work.
You posted the wrong script, this is your load data script. If you want us to help you understand why it isn't saving anything, you need to post the correct script.
You never use SetAsync so you never actually save player data. Line 11 is also a bad way to load existing data.