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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Editing this script, needs a line or two?

Previous Thread :: Next Thread 
kittyabs is not online. kittyabs
Joined: 24 Feb 2011
Total Posts: 10297
01 Sep 2013 04:46 PM
This is for a figure that goes after anything with a Humanoid, I tried to rename my humanoid but that killed the animations and what not, so how would I make it so that this figure thing doesn't go after anyone on team "A"

--------------------------------------------------
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 = 500
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("Right Arm")
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

human = script.Parent:findFirstChild("Humanoid")
if human == nil then human = script.Parent:findFirstChild("Zombie") end

while true do
wait(1)
local target = findNearestTorso(script.Parent.Torso.Position)
if target ~= nil then
human:MoveTo(target.Position, target)
human.TargetPoint = target.Position
end

end
Report Abuse
your90 is not online. your90
Joined: 06 Mar 2011
Total Posts: 1380
01 Sep 2013 04:49 PM
end
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
01 Sep 2013 04:49 PM
Get the player from the character and check it`s team...
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