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

Getting a number without numbers AFTER decimals?

Sorry for the bad question, but really simply how do this..:

number = 1.9999
--change
print(number)

Will print 2 rather than 1.9999.. etc

So how do I get a singular number without its decimals.

2 answers

Wouldn't a simple math.floor() do the job?

4 comments

0

I like this answer the most.

0

Haven't been on a while, sorry.

0

When a number ends in e-007, it means that the number is 7 decimal places smaller than it really is. For example, your first number 4.768371e-007 means that the number's true value is 0.0000004768371. It is a common bug found in roblox.

You need to define the type to use.

Here is the script I used:-

local a = 4.0342
print(tonumber(string.format("%d",a))) -- %d defines the type 

this uses string formatting to only take the number and not the decimals, then converts back to a number.

Hope this helps

Sorry I don't have time to find a list of data types.

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