generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Value Problems

Previous Thread :: Next Thread 
oseday is not online. oseday
Joined: 27 Aug 2008
Total Posts: 1308
05 Feb 2014 08:42 PM
for _,prts in ipairs(dot_storage:GetChildren()) do
if (intdot.Value).p+Vector3.new(0,0,-dist) == (prts.Value).p or (intdot.Value).p+Vector3.new(-dist,0,0) == (prts.Value).p then
link(intdot,prts)
end
end

intdot and prts are CFrameValue Objects.

Simple thing right? Think again.
In some cases playing with smaller numbers, it return 55.999999 or 56.00052 (Examples) where it should return 56.000000. This makes my script not to function properly.
Any ideas how to fix?
Report Abuse
david1234501 is not online. david1234501
Joined: 04 Oct 2008
Total Posts: 737
05 Feb 2014 08:48 PM
Isn't there some kind of math function to round to the nearest integer? I know math.floor() rounds down to the nearest integer, but there should be one that rounds to the nearest integer.
Report Abuse
dodleman is not online. dodleman
Joined: 22 Dec 2007
Total Posts: 1118
05 Feb 2014 09:25 PM
math.ceil()
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
06 Feb 2014 06:27 AM
Try this:

function round(n)
return math.floor(n * 1000 + 0.5) / 1000
end

floatssssss... and why did I enter this forum again? Not that I've got anything against it. - As, ohno, not 2 lines! also, cheap answer ):
Report Abuse
oseday is not online. oseday
Joined: 27 Aug 2008
Total Posts: 1308
06 Feb 2014 06:44 AM
Well, that rounding works to a point, thanks anyway. Let this thread die.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image