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 » Scripters
Home Search
 

Re: Move Humanoid to closest point.

Previous Thread :: Next Thread 
littleguy65 is not online. littleguy65
Joined: 13 Dec 2009
Total Posts: 39
19 Jul 2015 05:17 PM
If you compared four points, how would you use MoveTo to move to the closest point?

I know I might have asked something similar to this already, but I have absolutely no idea what I'm doing.
Report Abuse
littleguy65 is not online. littleguy65
Joined: 13 Dec 2009
Total Posts: 39
19 Jul 2015 05:29 PM
I wanted to compress this script somehow:

local pointA = Vector3.new( ... ) -- position a
local pointB = Vector3.new( ... ) -- position b
local pointC = Vector3.new( ... ) -- position c
local pointD = Vector3.new( ... ) -- position d
if (pointB - pointA).magnitude < (pointC - pointB).magnitude
and < (pointD - pointC).magnitude and < (pointA - pointD).magnitude then
---stuff
end

Any ideas? Or am I doing it wrong?
Report Abuse
littleguy65 is not online. littleguy65
Joined: 13 Dec 2009
Total Posts: 39
19 Jul 2015 05:33 PM
bump

Please help me. I am a horrible scripter.
Report Abuse
XtremeTemper is not online. XtremeTemper
Joined: 02 Mar 2012
Total Posts: 1774
19 Jul 2015 05:39 PM
You cant compare raw vectors...

This should find the nearest part within 100 studs and move the humanoid there.

for i,v in pairs(game.Workspace:getChildren()) do
if v:IsA("Part") then
local distance = (torso.Position - v.Position).magnitude
if distance <= 100 then
humanoid:MoveTo(v.Position)
end
end
end
Report Abuse
littleguy65 is not online. littleguy65
Joined: 13 Dec 2009
Total Posts: 39
19 Jul 2015 05:41 PM
Darn.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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