Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make this follow script follow a part and a player depending on which is closer?

Asked by 7 years ago
01local larm = script.Parent:FindFirstChild("Left Arm")
02local rarm = script.Parent:FindFirstChild("Right Arm")
03 
04function findNearestTorso(pos)
05    local list = game.Workspace:children()
06    local torso = nil
07    local dist = 20
08    local temp = nil
09    local human = nil
10    local temp2 = nil
11    for x = 1, #list do
12        temp2 = list[x]
13        if (temp2.className == "Model") and (temp2 ~= script.Parent) then
14            temp = temp2:findFirstChild("Torso")
15            human = temp2:findFirstChild("Humanoid")
View all 35 lines...

-- This script makes a noob follow a player. How can I make it go to "game.Workspace.Gate" if it is closer to the gate and follow a player if its closer to a player?

I have been trying for an hour and have not gotten anything to work. I tried to do a

do blah()

else if blah magnitude > blag then

do blah()

--Thanks

0
After 2 years, no-one answered this.. Also, this is a free model script. niroqeo 123 — 5y
0
You don't have to reinvent the wheel birdeater11 14 — 4y

Answer this question