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 » Scripters
Home Search
 

Re: Hey, does anybody know how to make a Zombie follow you?

Previous Thread :: Next Thread 
OdieboyDuck is not online. OdieboyDuck
Joined: 22 Sep 2010
Total Posts: 17169
01 Jul 2016 11:59 AM
I'm trying to make a game where DanTDMs follow you(don't ask), but I have no idea how to make them chase you. Does anybody know how? Whenever I find a follow script and I go into Test, it doesn't follow me.


https://www.roblox.com/OdieboyDuck-item?id=423970563 I will huff and I will puff and I will flame your post down!
Report Abuse
exoSentinel is not online. exoSentinel
Joined: 18 Mar 2012
Total Posts: 2795
01 Jul 2016 12:05 PM
:MoveTo
Report Abuse
OdieboyDuck is not online. OdieboyDuck
Joined: 22 Sep 2010
Total Posts: 17169
01 Jul 2016 12:08 PM
@exo

So, do I just put that in a script(I'm rather new to this)? Do I put anything after GoTo:?


https://www.roblox.com/OdieboyDuck-item?id=423970563 I will huff and I will puff and I will flame your post down!
Report Abuse
exoSentinel is not online. exoSentinel
Joined: 18 Mar 2012
Total Posts: 2795
01 Jul 2016 12:10 PM
Go to wiki.roblox.com and search for this.

If you still don't understand, try some other tutorials that are simpler until you get the hang of things.
Report Abuse
binkiklou is not online. binkiklou
Joined: 02 Aug 2012
Total Posts: 98
01 Jul 2016 12:10 PM
You need to understand that to know who the Zombie follow you need to make him :MoveTo the neareast player(character)
Report Abuse
Aethex is not online. Aethex
Joined: 16 Oct 2011
Total Posts: 2193
01 Jul 2016 12:12 PM
I assume you know what welds are? It would be easy to simply weld an invisible non-CanCollide object to the zombie and then use the Touched event (it's supposed to be as large as your radius for this is) and then use the MoveTo property of the Humanoid object of the zombie (not to be confused with the MoveTo property of the Model object--which would just make your zombie teleport) assuming you built them correctly. The MoveTo property of the Humanoid makes it walk to a position. You could technically just continuously change the position they need to walk to, though there are probably better methods of movement.
Report Abuse
Aethex is not online. Aethex
Joined: 16 Oct 2011
Total Posts: 2193
01 Jul 2016 12:14 PM
Here are some wiki links to help you with my suggestion on how to do this:

http://wiki.roblox.com/index.php?title=API:Class/Humanoid/MoveTo
http://wiki.roblox.com/index.php?title=Weld
http://wiki.roblox.com/index.php?title=Loops
http://wiki.roblox.com/index.php?title=API:Class/BasePart/Touched
Report Abuse
kangerujack is not online. kangerujack
Joined: 08 Nov 2009
Total Posts: 690
01 Jul 2016 12:24 PM
local dist = 200

local me = script.Parent
local human = script.Parent.Humanoid

function chase()
for _,v in pairs(workspace:getChildren()) do
if v:findFirstChild("Humanoid") and v:findFirstChild("Torso") then
if (me.Torso.Position - v.Torso.Position).magnitude < dist then
human:MoveTo(v.Torso.Position,v.Torso)
end
end
end
end

while wait() do
chase()
end
Report Abuse
Aethex is not online. Aethex
Joined: 16 Oct 2011
Total Posts: 2193
01 Jul 2016 12:26 PM
@kangerujack pls no

Do you know how taxing that is? Especially considering the fact that there is more than one zombie in the game. Most likely, there will be hundreds. It's a terrible idea to loop like that, especially considering the fact that you're looping that function roughly every 1/30 of a second.

@OP You should use my method with the Touched event.
Report Abuse
kangerujack is not online. kangerujack
Joined: 08 Nov 2009
Total Posts: 690
01 Jul 2016 12:47 PM
@Aexthex blah blah blah muh efficient code

local dist = 200

local me = script.Parent
local torso = me.Torso
local human = script.Parent.Humanoid

function chase(hit)
if hit.Parent:findFirstChild("Humanoid") and hit.Parent:findFirstChild("Torso") then
local enemyTorso = hit.Parent.Torso
local enemyHuman = hit.Parent.Humanoid
repeat wait(0.1)
human:MoveTo(hit.Parent.Torso.Position. hit.Parent.Torso)
until enemyTorso == nil or enemyHuman.Health < 1 or (enemyTorso.Position - torso.Position).magnitude > dist
end
end

local detectBrick = Instance.new("Part",me)
detectBrick.Size = Vector3.new(dist,dist,dist)
detectBrick.Anchored = true
detectBrick.CanCollide = false
detectBrick.Transparency = 1
detectBrick.Touched:connect(chase)

local w = Instance.new("Weld")
w.Part0 = torso
w.Part1 = detectBrick
w.Parent = me
Report Abuse
OdieboyDuck is not online. OdieboyDuck
Joined: 22 Sep 2010
Total Posts: 17169
01 Jul 2016 02:58 PM
None of these appear to be working in Studio. I've put them both(not at the same time) into the Humanoid/Zombie and the DanTDM models in the workspace, and they don't follow me.


https://www.roblox.com/OdieboyDuck-item?id=423970563 I will huff and I will puff and I will flame your post down!
Report Abuse
OdieboyDuck is not online. OdieboyDuck
Joined: 22 Sep 2010
Total Posts: 17169
01 Jul 2016 03:01 PM
Figured it out, I had to unlock/unanchor the model first. Thanks, guys! :)


https://www.roblox.com/OdieboyDuck-item?id=423970563 I will huff and I will puff and I will flame your post down!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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