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

How do I round a value to the nearest .01?

I've been looking all over the wiki, yet I can't seem to figure out how to round down a value to the nearest .01. This is the portion of my script where I attempted to round the value:

math.floor((tick() - start)*100/100)

However, when printed the value still turns out as a whole number. Any help would be appreciated.

1 answer

Instead of putting the *100/100 inside of the same operation, maybe try:

math.floor((tick() - start)*100)/100

This is because math.floor will always round to the nearest integer, but that integer can only be manipulated from outside the math.floor() function.

2 comments

0

Thanks, it should've been obvious for me, not sure why it passed right over my head. This worked perfectly.

0

Glad to hear it.

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