|
| 17 Jun 2014 11:37 AM |
The zombie continues to chase me even after I'm out of it's range
CloseEnough = false while true do for i,v in pairs(game.Players:GetChildren()) do if (v.Character.Torso.Position - script.Parent.Torso.Position).magnitude <=15 then CloseEnough = true while CloseEnough do wait(.1) PlayerPos = v.Character.Torso.Position script.Parent.Humanoid.WalkToPoint = PlayerPos end repeat wait(.1) until (v.Character.Torso.Position - script.Parent.Torso.Position).magnitude >=15 else CloseEnough = false repeat wait(.1) until (v.Character.Torso.Position - script.Parent.Torso.Position).magnitude <=15 end end wait() end |
|
|
| Report Abuse |
|
|
|
| 17 Jun 2014 11:41 AM |
while true do for i,v in pairs(game.Players:GetChildren()) do
repeat wait(.1) PlayerPos = v.Character.Torso.Position script.Parent.Humanoid.WalkToPoint = PlayerPos end until (v.Character.Torso.Position - script.Parent.Torso.Position).magnitude >=15
end wait() end
Try this. |
|
|
| Report Abuse |
|
|
|
| 17 Jun 2014 11:43 AM |
Remove the end in
epeat wait(.1) PlayerPos = v.Character.Torso.Position script.Parent.Humanoid.WalkToPoint = PlayerPos end until (v.Character.Torso.Position - script.Parent.Torso.Position).magnitude >=15 |
|
|
| Report Abuse |
|
|
|
| 17 Jun 2014 11:57 AM |
Not Quite, It simply follows me whereever then
better yet, why wont this work?
CloseEnough = false while true do for i,v in pairs(game.Players:GetChildren()) do if (v.Character.Torso.Position - script.Parent.Torso.Position).magnitude <=15 then CloseEnough = true if CloseEnough == true then repeat wait() PlayerPos = v.Character.Torso.Position script.Parent.Humanoid.WalkToPoint = PlayerPos until (v.Character.Torso.Position - script.Parent.Torso.Position).magnitude >=15 CloseEnough = false end else CloseEnough = false repeat wait() until (v.Character.Torso.Position - script.Parent.Torso.Position).magnitude <=15 CloseEnough = true end end wait() end |
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Jun 2014 12:01 PM |
the thing is, even if its out f range, it still has already told the humanoid to go over there
itll automaticly stop after like 5 seconds, but by then it might be in range again
set the zombies WalkSpeed to 0 if hes not close enough, and back to 16 if he is |
|
|
| Report Abuse |
|
|