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: Am I allowed to do something like this?

Previous Thread :: Next Thread 
iPremiumZ is not online. iPremiumZ
Joined: 23 Jan 2012
Total Posts: 6834
03 Apr 2012 08:38 PM
Like dat?

human = temp2:findFirstChild(script.Parent.Follow.Value)
Report Abuse
iPremiumZ is not online. iPremiumZ
Joined: 23 Jan 2012
Total Posts: 6834
03 Apr 2012 08:40 PM
x_X
Report Abuse
iPremiumZ is not online. iPremiumZ
Joined: 23 Jan 2012
Total Posts: 6834
03 Apr 2012 08:41 PM
Like I have a stringvalue "follow" and I want it to go after that humanoid?
Report Abuse
iPremiumZ is not online. iPremiumZ
Joined: 23 Jan 2012
Total Posts: 6834
03 Apr 2012 08:50 PM
So, it didn't work, any way to fix
Report Abuse
iPremiumZ is not online. iPremiumZ
Joined: 23 Jan 2012
Total Posts: 6834
03 Apr 2012 08:56 PM
anybody.
Report Abuse
iPremiumZ is not online. iPremiumZ
Joined: 23 Jan 2012
Total Posts: 6834
03 Apr 2012 09:00 PM
raig.
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
03 Apr 2012 09:02 PM
Yes.
Report Abuse
iPremiumZ is not online. iPremiumZ
Joined: 23 Jan 2012
Total Posts: 6834
03 Apr 2012 09:03 PM
@ darkmist, it doesnt work though qq
Report Abuse
iPremiumZ is not online. iPremiumZ
Joined: 23 Jan 2012
Total Posts: 6834
03 Apr 2012 09:03 PM
I used the common follow script.

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 = 250
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("Torso")
human = temp2:findFirstChild(script.Parent.Follow.Value)
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 = findNearestTorso(script.Parent.Torso.Position)
if target ~= nil then
script.Parent.Enemy:MoveTo(target.Position, target)
end
end
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
03 Apr 2012 09:06 PM
temp2:findFirstChild(script.Parent.Follow.Value, true) ????
Report Abuse
iPremiumZ is not online. iPremiumZ
Joined: 23 Jan 2012
Total Posts: 6834
03 Apr 2012 09:08 PM
it's not a boolvalue, it's a string
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
03 Apr 2012 09:09 PM
What is the value?

I'm really confused :l
Report Abuse
iPremiumZ is not online. iPremiumZ
Joined: 23 Jan 2012
Total Posts: 6834
03 Apr 2012 09:10 PM
The value is a stringvalue, the value is "Zombie" I'm trying to make it so that it follows whatever humanoid value thing
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
03 Apr 2012 09:13 PM
Why not just do something like this:

for _, v in pairs(game.Players:GetChildren()) do
v.Character -- ect
Report Abuse
iPremiumZ is not online. iPremiumZ
Joined: 23 Jan 2012
Total Posts: 6834
03 Apr 2012 09:14 PM
because it doesnt follow a player.
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
03 Apr 2012 09:19 PM
I don't know then;
my attention span can't follow this :l

Try creating one from scratch.
Report Abuse
iPremiumZ is not online. iPremiumZ
Joined: 23 Jan 2012
Total Posts: 6834
03 Apr 2012 09:21 PM
xx
Report Abuse
gameboy97q is not online. gameboy97q
Joined: 13 Sep 2008
Total Posts: 2831
03 Apr 2012 09:43 PM
Ok, so, your follow value is a string. I assume that you are using the value because you want to be able to follow different things, depending if it's a Player's humanoid or something else (i.e. an Enemy), right? Also, why are you using both temp and torso variables? They would both equal the same thing.
Report Abuse
Eyin is not online. Eyin
Joined: 10 Oct 2009
Total Posts: 567
03 Apr 2012 09:46 PM
You should write out some fresh code so you can actually understand what it does.

function FindFollowValue(stringName)
for i,v in pairs(Workspace:GetChildren()) do
if v.Name == stringName and v:FindFirstChild("Humanoid") then
FollowUntilDead(v.Torso)
end
end
end

function FollowUntilDead(part)
while wait() and part and part.Humanoid.Health > 0 do
script.Parent.Humanoid:MoveTo(part.Position, part)
end
end
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