Hey im trying to display a IntValue (with a text label) with a NumberValue How do i do that. I dont want it to display decimals but i need decimals to add some features.
COMMUNITY QUESTION
How do i make a IntValue change from a NumberValue?
1 answer
As the comments say, use math.floor().
math.floor(num) returns num in its truncated form (to truncate a number means to chop off the decimal point, which means that 3.95 would become 3). math.ceil(num) (which is what you shouldn't use) returns the 'raised' form of num to the next integer. (You should not use this because math.floor() can do this. I'm about to show you how.)
If you want to round a number, then use math.floor(num + 0.5). Do not use math.ceil().
Demonstration:
print(math.floor(3.2 + 0.5)) -- Prints 3 because 3.2 + 0.5 = 3.7
print(math.floor(3.6 + 0.5)) -- Prints 4 because 3.6 + 0.5 = 4.1
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
math.floor(value) to round down. Or math.ceil(value) to round up
wdym value the8bitdude11
(value), as in the value you want to round
If you only want integers just use a IntValue and just add integers.