Hello so i have a Gui with a text in it and its supposed to update every frame. But it doesnt, can someone help.
Here is my code:
local Player = game.Players.LocalPlayer
local leaderstats = Player.leaderstats
task.wait(1)
local T = {“K”,“M”,“B”,“T”,“q”,“Q”,“s”,“S”,“O”,“N”,“d”,“U”,“D”}
local function formatNumber(n)
if not tonumber(n) then return n end
if n < 10000 then return math.floor(n) end
local d = math.floor(math.log10(n)/3)*3
local s = tostring(n/(10^d)):sub(1,5)
return s…" "…tostring(T[math.floor(d/3)])
end
local Coins = leaderstats.Coins.Value
local Strength = leaderstats.Strength.Value
game:GetService(“RunService”).RenderStepped:Connect(function()
script.Parent.Coins.Inside.CoinsText.Text = formatNumber(Coins)
script.Parent.Strength.Inside.StrengthText.Text = formatNumber(Strength) … “/Inf”
end)
Still the same thing, i used a while loop and it is a local script. Also it updates only once and doesnt update anymore when i join the game it updates and then it doesnt
local Player = game.Players.LocalPlayer
local leaderstats = Player.leaderstats
task.wait(1)
local T = {"K","M","B","T","q","Q","s","S","O","N","d","U","D"}
local function formatNumber(n)
if not tonumber(n) then return n end
if n < 10000 then return math.floor(n) end
local d = math.floor(math.log10(n)/3)*3
local s = tostring(n/(10^d)):sub(1,5)
return s.." "..tostring(T[math.floor(d/3)])
end
local Coins = leaderstats.Coins.Value
local Strength = leaderstats.Strength.Value
script.Parent.Coins.Inside.CoinsText.Text = formatNumber(Coins)
script.Parent.Strength.Inside.StrengthText.Text = formatNumber(Strength) .. "/Inf"
leaderstats.Coins:GetPropertyChangedSignal("Value"):Connect(function()
Coins = leaderstats.Coins.Value
Strength = leaderstats.Strength.Value
script.Parent.Coins.Inside.CoinsText.Text = formatNumber(Coins)
end)
leaderstats.Strength:GetPropertyChangedSignal("Value"):Connect(function()
Coins = leaderstats.Coins.Value
Strength = leaderstats.Strength.Value
script.Parent.Strength.Inside.StrengthText.Text = formatNumber(Strength) .. "/Inf"
end)
local Player = game.Players.LocalPlayer
local leaderstats = Player.leaderstats
task.wait(1)
local T = {“K”,“M”,“B”,“T”,“q”,“Q”,“s”,“S”,“O”,“N”,“d”,“U”,“D”}
local function formatNumber(n)
if not tonumber(n) then return n end
if n < 10000 then return math.floor(n) end
local d = math.floor(math.log10(n)/3)*3
local s = tostring(n/(10^d)):sub(1,5)
return s…" "…tostring(T[math.floor(d/3)])
end
local Coins = leaderstats.Coins.Value
local Strength = leaderstats.Strength.Value
while true do
script.Parent.Coins.Inside.CoinsText.Text = formatNumber(Coins)
script.Parent.Strength.Inside.StrengthText.Text = formatNumber(Strength) … “/Inf”
wait(0.001) -- Time between updates
end