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: how do i make this work only for teamcolor's humanoid

Previous Thread :: Next Thread 
Macxez is not online. Macxez
Joined: 03 Jan 2012
Total Posts: 102
02 Nov 2016 09:08 AM
bin = script.Parent

function move(target)
local dir = (target.Position - bin.Position).unit
local spawnPos = bin.Position
local pos = spawnPos + (dir * 1)
bin:findFirstChild("BodyGyro").cframe = CFrame.new(pos, pos + dir)
bin:findFirstChild("BodyGyro").maxTorque = Vector3.new(9000,9000,9000)
end

function moveTo(target)
bin.BodyPosition.position = target.Position
bin.BodyPosition.maxForce = Vector3.new(10000,10000,10000) * bin.Speed.Value
end

function findNearestTorso(pos)
local list = game.Workspace:GetChildren()
local torso = nil
local dist = 1000000
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("Left Leg")
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




Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
02 Nov 2016 09:10 AM
Don't make 3 threads for one thing.
Report Abuse
Macxez is not online. Macxez
Joined: 03 Jan 2012
Total Posts: 102
02 Nov 2016 09:22 AM
loln0


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