generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: It keeps coming back!

Previous Thread :: Next Thread 
ShinobiBlue is not online. ShinobiBlue
Joined: 01 Nov 2009
Total Posts: 4177
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
PerpetualMovement is not online. PerpetualMovement
Joined: 04 Dec 2012
Total Posts: 1001
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
PerpetualMovement is not online. PerpetualMovement
Joined: 04 Dec 2012
Total Posts: 1001
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
ShinobiBlue is not online. ShinobiBlue
Joined: 01 Nov 2009
Total Posts: 4177
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
ShinobiBlue is not online. ShinobiBlue
Joined: 01 Nov 2009
Total Posts: 4177
17 Jun 2014 12:00 PM
Got it
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image