How to make detect when part has reached Destination?
I realized that a Part in Roblox can not always be equivalent to it's Destination Part. So I was wondering if there was a way to Identify it part was near Destination Part or Detect has nearly stop moving because when I run the script below the Part does appear to stop moving to the naked eye but is always changing it's position slightly by very tiny digits. So can anyone help me with this problem I've encountered.
Soldiers = Part
Part2 = Destination, so you guys can know what I'm talking about.
03 | if Soldiers.Position.X ~ = Part 2. Position.X then |
04 | if Soldiers.Position.X > Part 2. Position.X then |
05 | Soldiers.Position = Soldiers.Position - Vector 3. new( 0.02 , 0 , 0 ) |
07 | if Soldiers.Position.X < Part 2. Position.X then |
08 | Soldiers.Position = Soldiers.Position + Vector 3. new( 0.02 , 0 , 0 ) |
11 | if Soldiers.Position.Z ~ = Part 2. Position.Z then |
12 | if Soldiers.Position.Z > Part 2. Position.Z then |
13 | Soldiers.Position = Soldiers.Position - Vector 3. new( 0 , 0 , 0.02 ) |
15 | if Soldiers.Position.Z < Part 2. Position.Z then |
16 | Soldiers.Position = Soldiers.Position + Vector 3. new( 0 , 0 , 0.02 ) |
19 | if Soldiers.Position.X = = Part 2. Position.X and Soldiers.Position.Z = = Part 2. Position.Z then |