I get the error "Expected , got 'end'"
Here is the script:
local ds = game:GetService("DataStoreService"):GetDataStore("--Cash01")
game.Players.PlayerAdded:Connect(function(player)
local key = "cash-"..player.userId
local folder = Instance.new("Folder",player)
folder.Name = "leaderstats"
local currency = Instance.new("IntValue",folder)
currency.Name = "Coins"
currency.Value = 0
local fake1 = Instance.new("StringValue")
fake1.Name = currency.Name
fake1.Value = tostring(currency.Value)
fake1.Parent = folder
while wait() do
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)
local save = ds:GetAsync(key)
if save then
currency.Value = save
end
currency.Changed:Connect(function()
ds:SetAsync(key,currency.Value)
end)
end)

1 comment
If my answer worked please accept it. The button should be under my answer. Also could you clarify what you mean by "it won't abbreviate".