I'm making a Value that shows in a GUI. I'd like to know how to make the text say 1.34B when the player has 1345869475 "dollars", but it comes up as 1.345869475B. Can someone help me simplify this?
while wait() do Value = script.Parent.Parent.Parent.Parent.Parent.NPCNumber.Warrior.Value if Value < 1000000 then script.Parent.Text = Value else if Value >= 1000000 and Value < 1000000000 then script.Parent.Text = (Value/1000000).."M" else if Value >= 1000000000 and Value < 2147483647 then script.Parent.Text = (Value/1000000000).."B" else if Value == 2147483647 then script.Parent.Text = "MAX" end end end end end
Any help is appreciated THANKS!
you could do something like this: (math.floor(Value/10^7))/10^2
Basically, put the number in the billion's place value in the hundred's place value, then round down to the nearest whole number, and then move the digit in the hundred's place to the one's place. That will give you two numbers behind the decimal and the number of billions in front of the decimal.
Example:
Value = 12425415074 --Value/10^7 = 1242.5415074 --math.floor(Value/10^7) = 1242 --(math.floor(Value/10^7))/10^2 = 12.42 print((math.floor(Value/10^7))/10^2.." B") -----------> 12.42 B