Macxez
|
  |
| Joined: 03 Jan 2012 |
| Total Posts: 102 |
|
|
| 02 Nov 2016 09:08 AM |
bin = script.Parent
function move(target) local dir = (target.Position - bin.Position).unit local spawnPos = bin.Position local pos = spawnPos + (dir * 1) bin:findFirstChild("BodyGyro").cframe = CFrame.new(pos, pos + dir) bin:findFirstChild("BodyGyro").maxTorque = Vector3.new(9000,9000,9000) end
function moveTo(target) bin.BodyPosition.position = target.Position bin.BodyPosition.maxForce = Vector3.new(10000,10000,10000) * bin.Speed.Value end
function findNearestTorso(pos) local list = game.Workspace:GetChildren() local torso = nil local dist = 1000000 local temp = nil local human = nil local temp2 = nil for x = 1, #list do temp2 = list[x] if (temp2.className == "Model") and (temp2 ~= script.Parent) then temp = temp2:findFirstChild("Left Leg") human = temp2:findFirstChild("Humanoid") if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then if (temp.Position - pos).magnitude < dist then torso = temp dist = (temp.Position - pos).magnitude end end end end return torso end
|
|
|
| Report Abuse |
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 02 Nov 2016 09:10 AM |
| Don't make 3 threads for one thing. |
|
|
| Report Abuse |
|
Macxez
|
  |
| Joined: 03 Jan 2012 |
| Total Posts: 102 |
|
| |