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

Help with simple math!? Can someone help? It rounds downwards.

So i want to do one thing in the future. I wanna round a number to the nearest thousand. I did this test that doesnt work. Help?

local x = 567
local a = 567 / 1000
local rounded = math.floor(a)
print (rounded * 1000)

for some reason it rounds downwards

3 comments

0

I know now

0

How would you do to round it to nearest number

0

If mattscy properly answered your question, be sure to mark his answer as correct!

1 answer

local number = 567
local rounded = math.floor(number/1000+0.5)*1000
print(rounded)

3 comments

0

Sorry forgot to multiply by 1000 again, edited.

0

Explain your answer! What did they not do? (Answer, they forgot to add .5 to the number they were flooring)

0

thx guys

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