of     1   

spinywind
#182293766Sunday, January 24, 2016 7:20 AM GMT

So when i divide to values onto a text, depending on what u divide, there are so many digits as a decimal like 6.432467654312432552, is there a way to make it so only 3 digits are shown like this 4.52? Heres my script: Kills = script.Parent.Parent.Parent.Parent.Parent.Parent.leaderstats.Kills.Value Deaths = script.Parent.Parent.Parent.Parent.Parent.Parent.leaderstats.Deaths.Value while true do script.Parent.Text = "" ..Kills/Deaths wait() end
Moronism
#182293872Sunday, January 24, 2016 7:23 AM GMT

Yes. What are you describing can be accomplished by using string.format and a "Control-string", as shown below: script.Parent.Text = ""..string.format("%.2f",tostring(Kills/Deaths)"); Does this help you? http://www.lua.org/manual/5.1/manual.html#pdf-string.format
spinywind
#182294014Sunday, January 24, 2016 7:27 AM GMT

its very hard to understand cause its not using an example related to my situation. Im still learning how to script as it is and as always thank you for your help. After i finish my script, im going to try to figure this new "part" in scripting out.
Weirdraidercs35
#182294170Sunday, January 24, 2016 7:32 AM GMT

you can just use math.floor, but thats only one digit
Moronism
#182294245Sunday, January 24, 2016 7:35 AM GMT

"its very hard to understand cause its not using an example related to my situation" Ah, my apologies for not explaining the usage thoroughly. Hopefully this will help you. String.format is a function that manipulates string data by formatting it according to the first argument provided. Here is an example: S = "1.123456789"; string.format("%.3f",S); print(S); --This would print "1.123"; Within the example that I provided, I have a string known as "1.123456789" The first argument within the string.format function, ".3f", will inform the interpreter that "S" has decimal values that need to be shortened to only the first three decimal numbers. "S", the second argument of the string.format function within the parentheses, is the actual string that needs to be modified accordingly. "f" refers to floating-point numerical data, which are decimal data values in C, the language that Lua is constructed from. If you wanted to determine which values should be omitted, you can simply use an expression such as "%.1f", which informs the interpreter that you would like to remove all decimal values after the first decimal number within the string. Hopefully this explanation assists you.
spinywind
#182294329Sunday, January 24, 2016 7:38 AM GMT

oh i see so the %.5 or whatever it is will shorten the decimal places in short terms. Ty so much i have a good understanding of it.
128Gigabytes
#182294406Sunday, January 24, 2016 7:40 AM GMT

'you can just use math.floor, but thats only one digit' local x = 1.23456 print(math.floor(x * 10) / 10) --[[> 1.2]] print(math.floor(x * 100) / 100) --[[> 1.23]]
spinywind
#182294459Sunday, January 24, 2016 7:41 AM GMT

ik but i prefer two for some reason
chimmihc
#182294673Sunday, January 24, 2016 7:47 AM GMT

It should be noted that string.format("%.3f",value) automatically rounds in the thousandths place. string.format("%.3f",1.1115) --> 1.111 string.format("%.3f",1.1116) --> 1.112

    of     1