iPremiumZ
|
  |
| Joined: 23 Jan 2012 |
| Total Posts: 6834 |
|
|
| 03 Apr 2012 08:38 PM |
Like dat?
human = temp2:findFirstChild(script.Parent.Follow.Value) |
|
|
| Report Abuse |
|
|
iPremiumZ
|
  |
| Joined: 23 Jan 2012 |
| Total Posts: 6834 |
|
| |
|
iPremiumZ
|
  |
| Joined: 23 Jan 2012 |
| Total Posts: 6834 |
|
|
| 03 Apr 2012 08:41 PM |
| Like I have a stringvalue "follow" and I want it to go after that humanoid? |
|
|
| Report Abuse |
|
|
iPremiumZ
|
  |
| Joined: 23 Jan 2012 |
| Total Posts: 6834 |
|
|
| 03 Apr 2012 08:50 PM |
| So, it didn't work, any way to fix |
|
|
| Report Abuse |
|
|
iPremiumZ
|
  |
| Joined: 23 Jan 2012 |
| Total Posts: 6834 |
|
| |
|
iPremiumZ
|
  |
| Joined: 23 Jan 2012 |
| Total Posts: 6834 |
|
| |
|
| |
|
iPremiumZ
|
  |
| Joined: 23 Jan 2012 |
| Total Posts: 6834 |
|
|
| 03 Apr 2012 09:03 PM |
| @ darkmist, it doesnt work though qq |
|
|
| Report Abuse |
|
|
iPremiumZ
|
  |
| Joined: 23 Jan 2012 |
| Total Posts: 6834 |
|
|
| 03 Apr 2012 09:03 PM |
I used the common follow script.
local larm = script.Parent:FindFirstChild("Left Arm") local rarm = script.Parent:FindFirstChild("Right Arm")
function findNearestTorso(pos) local list = game.Workspace:children() local torso = nil local dist = 250 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("Torso") human = temp2:findFirstChild(script.Parent.Follow.Value) 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
while true do wait(0.1) local target = findNearestTorso(script.Parent.Torso.Position) if target ~= nil then script.Parent.Enemy:MoveTo(target.Position, target) end end |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2012 09:06 PM |
| temp2:findFirstChild(script.Parent.Follow.Value, true) ???? |
|
|
| Report Abuse |
|
|
iPremiumZ
|
  |
| Joined: 23 Jan 2012 |
| Total Posts: 6834 |
|
|
| 03 Apr 2012 09:08 PM |
| it's not a boolvalue, it's a string |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2012 09:09 PM |
What is the value?
I'm really confused :l |
|
|
| Report Abuse |
|
|
iPremiumZ
|
  |
| Joined: 23 Jan 2012 |
| Total Posts: 6834 |
|
|
| 03 Apr 2012 09:10 PM |
| The value is a stringvalue, the value is "Zombie" I'm trying to make it so that it follows whatever humanoid value thing |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2012 09:13 PM |
Why not just do something like this:
for _, v in pairs(game.Players:GetChildren()) do v.Character -- ect |
|
|
| Report Abuse |
|
|
iPremiumZ
|
  |
| Joined: 23 Jan 2012 |
| Total Posts: 6834 |
|
|
| 03 Apr 2012 09:14 PM |
| because it doesnt follow a player. |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2012 09:19 PM |
I don't know then; my attention span can't follow this :l
Try creating one from scratch. |
|
|
| Report Abuse |
|
|
iPremiumZ
|
  |
| Joined: 23 Jan 2012 |
| Total Posts: 6834 |
|
| |
|
|
| 03 Apr 2012 09:43 PM |
| Ok, so, your follow value is a string. I assume that you are using the value because you want to be able to follow different things, depending if it's a Player's humanoid or something else (i.e. an Enemy), right? Also, why are you using both temp and torso variables? They would both equal the same thing. |
|
|
| Report Abuse |
|
|
Eyin
|
  |
| Joined: 10 Oct 2009 |
| Total Posts: 567 |
|
|
| 03 Apr 2012 09:46 PM |
You should write out some fresh code so you can actually understand what it does.
function FindFollowValue(stringName) for i,v in pairs(Workspace:GetChildren()) do if v.Name == stringName and v:FindFirstChild("Humanoid") then FollowUntilDead(v.Torso) end end end
function FollowUntilDead(part) while wait() and part and part.Humanoid.Health > 0 do script.Parent.Humanoid:MoveTo(part.Position, part) end end |
|
|
| Report Abuse |
|
|