while true do wait(1) script.Parent.Text = game.Players.LocalPlayer.Data.Lvl.Value end
What this script does is show your players level in a gui. Yes I know there is other ways to do this than using while true do, but that is not my problem. I am trying to add commas to it when it updates the text to your level number so kinda like this 1000 is what it normally puts. I want it to say "1,000" so players can read large numbers more easy such as "10,000,000." I have tried various ways and all of them have not worked.
Thank you for reading and if you have any questions about this go ahead and ask.
An example from Destrings...
”Let's take "250000" for example, if we use string.gsub("25000", "(%d%d%d)", "%1,") it will return 250,00 because it searches the string from left to right, so we have to reverse it.
string.reverse("25000"):gsub("(%d%d%d)", "%1,") will return "000,52" so we reverse it again to revert the process. string.reverse("25000"):gsub("(%d%d%d)", "%1,") :reverse() and that's it.”
local function addComas(str) return #str % 3 == 0 and str:reverse():gsub("(%d%d%d)", "%1,"):reverse():sub(2) or str:reverse():gsub("(%d%d%d)", "%1,"):reverse() end print(addComas("250000000")) print(addComas("25000000"))
Marked as Duplicate by Shawnyg
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?