So I am currently in the middle of trying to make this work, I have a billboardgui inside a script, for overhead gui, when the value changes on the billboards in game, it then proceeds to make more and more of the same one with the old one behind it as it hasn’t been removed, I can provide screenshot of the issue if needed thanks
Could you provide some screenshots and possibly the code? It will make it much easier to help you.
local abbrev = {"", "K", "M", "B"}
local function Format(value, idp)
local ex = math.floor(math.log(math.max(1, math.abs(value)),1000))
local abbrevs = abbrev[1 + ex] or ("e+"..ex)
local normal = math.floor(value * ((10 ^ idp) / (1000 ^ ex))) / (10 ^ idp)
return ("%."..idp.."f%s"):format(normal, abbrevs)
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
if char:FindFirstChild("Head") and player then
while wait() do
local clone = script.BillboardGui:Clone()
clone.Parent = char:FindFirstChild("Head")
-----------------------------------------
clone.TextLabel.Text = "Total Power: "..Format(player:WaitForChild("Total Power").Value,2)
end
end
end)
end)
So when I’m in game, and the value is set, if it changes it sets another value, leaving the before billboardgui underneath the new one, I’ll get a screenshot of it
Try this,
local abbrev = {"", "K", "M", "B"}
local function Format(value, idp)
local ex = math.floor(math.log(math.max(1, math.abs(value)),1000))
local abbrevs = abbrev[1 + ex] or ("e+"..ex)
local normal = math.floor(value * ((10 ^ idp) / (1000 ^ ex))) / (10 ^ idp)
return ("%."..idp.."f%s"):format(normal, abbrevs)
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
if char:FindFirstChild("Head") and player then
local clone = script.BillboardGui:Clone()
clone.Parent = char:FindFirstChild("Head")
-----------------------------------------
clone.TextLabel.Text = "Total Power: "..Format(player:WaitForChild("Total Power").Value,2)
end
end)
end)
It works, like the Value shows, the billboardGui shows, but the value dosen’t change when its increased, it shows it increased but the billboardgui>TextLabel shows the same value before its changed
Try this and tell me if it works,
local abbrev = {"", "K", "M", "B"}
local function Format(value, idp)
local ex = math.floor(math.log(math.max(1, math.abs(value)),1000))
local abbrevs = abbrev[1 + ex] or ("e+"..ex)
local normal = math.floor(value * ((10 ^ idp) / (1000 ^ ex))) / (10 ^ idp)
return ("%."..idp.."f%s"):format(normal, abbrevs)
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
if char:FindFirstChild("Head") and player then
local clone = script.BillboardGui:Clone()
clone.Parent = char:FindFirstChild("Head")
-----------------------------------------
player:WaitForChild("Total Power").Changed:Connect(function()
clone.TextLabel.Text = "Total Power: "..Format(player["Total Power"].Value,2)
end)
end
end)
end)
Thank you also for taking your time to help me, i very much appreciate it
Oops my bad, forgot one thing. Try this,
local abbrev = {"", "K", "M", "B"}
local function Format(value, idp)
local ex = math.floor(math.log(math.max(1, math.abs(value)),1000))
local abbrevs = abbrev[1 + ex] or ("e+"..ex)
local normal = math.floor(value * ((10 ^ idp) / (1000 ^ ex))) / (10 ^ idp)
return ("%."..idp.."f%s"):format(normal, abbrevs)
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
if char:FindFirstChild("Head") and player then
local clone = script.BillboardGui:Clone()
clone.Parent = char:FindFirstChild("Head")
-----------------------------------------
clone.TextLabel.Text = "Total Power: "..Format(player:WaitForChild("Total Power").Value,2)
player:WaitForChild("Total Power").Changed:Connect(function()
clone.TextLabel.Text = "Total Power: "..Format(player["Total Power"].Value,2)
end)
end
end)
end)
Yeahh it worked, the value is changing, and also showing, and the before value also vanishes once the number is increased, and its working great, thank you Enomphia
.Changed is kinda outdated it would be better using :GetPropertyChangedSignal tbh its way better and it only detects of 1 property not every single property
In OP’s case .Changed and :GetProperyChangedSignal(“Value”) are going to do the exact same thing as he is not changing the name of the number value which means .Changed wont be firing a bunch of times for no reason.