Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there a way to check specific digit in a number?

What I am wondering is if there is a way to check a specific place value?

For example, if a number is 52.8, is there a way that I can see what the value of the decimal place?

1 answer

✓ Accepted answer

Yes you can! You can use string.sub(), try using this:

local number = 52.8
local decimal = string.sub(number, 4) -- 4 is the 4th value in the number. so in this case, its 8
print(decimal) --> 8

If this help, then please accept this answer!

2 comments

0

Thank you! This is very helpful to know!

0

No problem.

This discussion is preserved as it was. New answers, comments, and votes are closed.