123coolz
|
  |
| Joined: 29 May 2010 |
| Total Posts: 4 |
|
|
| 06 Jun 2017 06:12 PM |
local a = script.Parent.Torso.Position repeat print("going") script.Parent.Humanoid:MoveTo(Vector3.new(10, 4, -142)) wait(1) until a == (Vector3.new(10, 4, -142))
The NPC will travel to its target. Once the NPC reaches the target, it is barely off, so it will keep repeating. Is there a way to stop the repeat loop once the NPC has reached within a certain range of studs of the target? |
|
|
| Report Abuse |
|
|
|
| 06 Jun 2017 06:15 PM |
magnitude
if (player.torso.Position - npc.Torso.Position).magnitude <= 12 then then some way to break loop here? end
#code print("oh no an errorz!") |
|
|
| Report Abuse |
|
|
|
| 06 Jun 2017 06:15 PM |
'then some way to break loop here?'
You mean break? |
|
|
| Report Abuse |
|
|
|
| 06 Jun 2017 06:17 PM |
yes
#code print("oh no an errorz!") |
|
|
| Report Abuse |
|
|
|
| 06 Jun 2017 06:28 PM |
| If the problem is that the NPC is off of the target location by a few decimal points, math.ceil might fix your issue |
|
|
| Report Abuse |
|
|