#help with adding commas

1 messages · Page 1 of 1 (latest)

hot night
#

how do i add commas to this

local TweenService = game:GetService("TweenService")

local TIME = 1 -- Time in seconds
local EASINGSTYLE = Enum.EasingStyle.Quart -- Tween easing style
local EASINGDIRECTION = Enum.EasingDirection.InOut 
local Leaderstats = Players.LocalPlayer:WaitForChild("leaderstats")
local MoneyInt = Leaderstats:WaitForChild("clicks")
local MoneyText = script.Parent

local TransitionAmount = Instance.new("IntValue")

TransitionAmount.Value = MoneyInt.Value

MoneyInt.Changed:Connect(function(amount) 

    local tween = TweenService:Create(
        TransitionAmount,
        TweenInfo.new(TIME, EASINGSTYLE, EASINGDIRECTION),
        {Value = amount}
    ) value.

    tween:Play()
end)

TransitionAmount.Changed:Connect(function(amount) 
    MoneyText.Text = tostring(amount) 
end) ```
glossy forum
#

local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")

local TIME = 1
local EASINGSTYLE = Enum.EasingStyle.Quart
local EASINGDIRECTION = Enum.EasingDirection.InOut
local Leaderstats = Players.LocalPlayer:WaitForChild("leaderstats")
local MoneyInt = Leaderstats:WaitForChild("clicks")
local MoneyText = script.Parent

local TransitionAmount = Instance.new("IntValue")
TransitionAmount.Value = MoneyInt.Value

local function formattaNumero(num)
return tostring(num):reverse():gsub("(%d%d%d)", "%1,"):reverse():gsub("^,", "")
end

MoneyInt.Changed:Connect(function(amount)
local tween = TweenService:Create(
TransitionAmount,
TweenInfo.new(TIME, EASINGSTYLE, EASINGDIRECTION),
{Value = amount}
)
tween:Play()
end)

TransitionAmount.Changed:Connect(function(amount)
MoneyText.Text = formattaNumero(amount)
end)