|
| 12 Aug 2015 04:35 PM |
Is there any way to round a part's position to the nearest number?
|
|
|
| Report Abuse |
|
|
|
| 12 Aug 2015 04:38 PM |
I used to have a code that did this, but I had it on the Family PC that we had to reset and I forgot how I did it. But if it helps, it should be possible. |
|
|
| Report Abuse |
|
|
|
| 12 Aug 2015 04:39 PM |
function roundToNearest4(num) local remainder = num % 1 local numfloored = num - remainder if remainder / 1 >= 0.5 then return numfloored + 1 else return numfloored end end
FOUND IT!
Should work, sorry if it doesn't. It rounds a number to the neared whole number. |
|
|
| Report Abuse |
|
|
Sasayaki
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 33868 |
|
|
| 12 Aug 2015 04:53 PM |
"function roundToNearest4(num) local remainder = num % 1 local numfloored = num - remainder if remainder / 1 >= 0.5 then return numfloored + 1 else return numfloored end end"
Alternatively
function roundToNearest4(num) return math.floor(num+.5) end |
|
|
| Report Abuse |
|
|