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: Help with a follow script

Previous Thread :: Next Thread 
ice20039ALT is not online. ice20039ALT
Joined: 12 Jun 2014
Total Posts: 379
25 Sep 2014 06:39 PM
I need help fixing this script:
Problem: Doesn't follow "Test"


local larm = script.Parent:FindFirstChild("Left Arm")
local rarm = script.Parent:FindFirstChild("Right Arm")

function findNearestTest(pos)
local list = game.Workspace:children()
local torso = nil
local dist = 25
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("Test")
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 = findNearestTest(script.Parent.Test.Position)
if target ~= nil then
script.Parent.Humanoid:MoveTo(target.Position, target)
end
end
Report Abuse
ice20039ALT is not online. ice20039ALT
Joined: 12 Jun 2014
Total Posts: 379
25 Sep 2014 06:41 PM
bump
Report Abuse
ice20039ALT is not online. ice20039ALT
Joined: 12 Jun 2014
Total Posts: 379
25 Sep 2014 06:43 PM
3 Minutes later.........
Report Abuse
ice20039ALT is not online. ice20039ALT
Joined: 12 Jun 2014
Total Posts: 379
25 Sep 2014 06:44 PM
anyone?
Report Abuse
ice20039ALT is not online. ice20039ALT
Joined: 12 Jun 2014
Total Posts: 379
25 Sep 2014 06:45 PM
b2
Report Abuse
whyitmatters is not online. whyitmatters
Joined: 06 Apr 2013
Total Posts: 294
25 Sep 2014 06:47 PM
local larm = script.Parent:FindFirstChild("Left Arm")
local rarm = script.Parent:FindFirstChild("Right Arm")

function findNearestTest(script.Parent.Test.Position)
local list = game.Workspace:children()
local torso = 0.1
local dist = 25
local temp = nil
local human = 20
local temp2 = nil
for x = 1, (list do
temp2 = list[x]
if (temp2.className == "Model") and (temp2 ~= script.Parent) then
temp = temp2:findFirstChild("Test")
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 = findNearestTest(script.Parent.Test.Position)
if target ~= nil then
script.Parent.Humanoid:MoveTo(target.Position; target)
end
end
Report Abuse
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
25 Sep 2014 06:47 PM
looks like something i've seen before
Report Abuse
whyitmatters is not online. whyitmatters
Joined: 06 Apr 2013
Total Posts: 294
25 Sep 2014 06:49 PM
^i know right!!!
Report Abuse
ice20039ALT is not online. ice20039ALT
Joined: 12 Jun 2014
Total Posts: 379
25 Sep 2014 06:54 PM
^ I know right
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