|
| 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 |
|
|
|
| 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 |
|
|
|
| 19 Jul 2015 05:33 PM |
bump
Please help me. I am a horrible scripter. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
| |
|