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: Why not work?

Previous Thread :: Next Thread 
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
08 Nov 2015 06:43 PM
dist = 50
function findNearestTorso(pos)
local list = game.Workspace:children()
local torso = nil
local temp = nil
local human = nil
local temp2 = nil
local NAMES = 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("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

function Hit(hit)
local human = hit.Parent:FindFirstChild("Humanoid")
if human ~= nil then
human.Health = human.Health-0
end
end
local torso = script.Parent.Torso
torso.Touched:connect(Hit)

while true do
wait(0.1)
local target = findNearestTorso(script.Parent.Torso.Position)
if target ~= nil then
script.Parent.Animal:MoveTo(target.Position, target)--and this humanoid/zombie
else
end
end



Here is the script, the model itself is two bricks one named "Torso" and the other named "Head" there is a Humanoid called "Animal" the walkspeed is -10 (so it runs away) and the other thing in the model is this script and a weld in the torso connecting it to the head.

So my problem is that the two bricks just sit there and don't move. I know it probably has to do with the fact of no arms or legs, but how can I get the "Animal" to move away from "Humanoids", but while still having health and a walkspeed?
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
08 Nov 2015 06:56 PM
bump
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
08 Nov 2015 06:57 PM
FM much?
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
08 Nov 2015 07:04 PM
fm?
Report Abuse
z4qqq6 is not online. z4qqq6
Joined: 05 Jul 2010
Total Posts: 87
08 Nov 2015 07:16 PM
fm = free model
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
08 Nov 2015 07:18 PM
war, unlike you he didn't claim he made it.

To move it away, use the opposite direction -(nearestTorso - torso).unit and call MoveTo and move it in that direction x studs (multiply it by x)
Report Abuse
DrHaximus is not online. DrHaximus
Joined: 22 Nov 2011
Total Posts: 8410
08 Nov 2015 07:19 PM
R O A S T E D
O
A
S
T
E
D
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
08 Nov 2015 07:22 PM
I fixed the problem, I just added arms/legs to the model and made them invisible. I guess it had something to with the Humanoid factor.
Report Abuse
z4qqq6 is not online. z4qqq6
Joined: 05 Jul 2010
Total Posts: 87
08 Nov 2015 07:25 PM
n
i
c
e

s
a
v
e

b
r
o
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
08 Nov 2015 07:33 PM
Aaannnddd it broke again

now the humanoidrootpart runs away (like it's supposed to) but the rest of the rabbit stays behind (not right).

I tired Welding the part with the part0 being the humanoidrootpart, and part1 being the torso, but now it doesn't move at all, what else can I do?

It was working, then i changed the face decal and it stopped working...
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
08 Nov 2015 07:34 PM
"war, unlike you he didn't claim he made it."

OH MY GOSH HE DIDN'T SOURCE ANYBODY THOUGH.

!!!!!!!!

SOMEBODY CALL THE COPYRIGHT POLICE, THIS GUY IS LIKE A MAJOR VIOLATION.




cnt, you really gotta let things go bro.
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
08 Nov 2015 07:34 PM
Ooo

DrHaximus joined Roblox on my birthday :D
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
08 Nov 2015 07:36 PM
lol war is mad
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
08 Nov 2015 07:37 PM
any help w/ my problem?
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
08 Nov 2015 09:56 PM
Mad as in insane or angry? If the former, yes, for about 8 months now.

If the latter, not really, just trying to prove a point.
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
09 Nov 2015 03:59 PM
Now the humanoidrootpart runs away (like it's supposed to) but the rest of the rabbit stays behind (not right).

I tired Welding the part with the part0 being the humanoidrootpart, and part1 being the torso, but now it doesn't move at all, what else can I do?
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
09 Nov 2015 05:04 PM
bump
Report Abuse
DeveloperBlue is not online. DeveloperBlue
Joined: 15 Apr 2009
Total Posts: 1344
09 Nov 2015 05:08 PM
Is anything anchored?
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
09 Nov 2015 05:15 PM
No
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
09 Nov 2015 05:47 PM
b1
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
09 Nov 2015 05:54 PM
b2
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