|
| 23 Feb 2013 10:10 AM |
I'm trying to make a humanoid fly away if it's health is less than 3,000.
if script.Parent.Humanoid.Health =< 3000 then local bv = Instance.new("BodyVelocity") bv.maxForce = (4000, 4000, 4000) bv.P = 1250 bv.velocity = Vector3.new(0, 10, 0) bv.Parent = script.Parent.Torso end end |
|
|
| Report Abuse |
|
|
|
| 23 Feb 2013 10:12 AM |
You have an extra end. Also, if I'm right, it's <=, not =<. |
|
|
| Report Abuse |
|
|
noah
|
  |
| Joined: 11 Sep 2006 |
| Total Posts: 18977 |
|
| |
|
JamG700
|
  |
| Joined: 31 Jan 2009 |
| Total Posts: 906 |
|
|
| 23 Feb 2013 10:13 AM |
| if script.Parent.Humanoid.Health < 3000 then |
|
|
| Report Abuse |
|
|
|
| 23 Feb 2013 10:15 AM |
| When I changed it to <= I get ')' expected near ',' on line two. |
|
|
| Report Abuse |
|
|
JamG700
|
  |
| Joined: 31 Jan 2009 |
| Total Posts: 906 |
|
|
| 23 Feb 2013 10:17 AM |
| Give us the entire script. |
|
|
| Report Abuse |
|
|
|
| 23 Feb 2013 10:17 AM |
| What I posted is the entire script. |
|
|
| Report Abuse |
|
|
Struanmcd
|
  |
| Joined: 19 Sep 2008 |
| Total Posts: 369 |
|
|
| 23 Feb 2013 10:21 AM |
if script.Parent.Humanoid.Health <= 3000 then local bv = Instance.new("BodyVelocity") bv.maxForce = Vector3.new(4000, 4000, 4000) bv.P = 1250 bv.velocity = Vector3.new(0, 10, 0) bv.Parent = script.Parent.Torso end
Three problems you had: 1. An extra end 2. MaxForce needed a Vector3 declaration 3. =< should be <= |
|
|
| Report Abuse |
|
|
| |
|
Struanmcd
|
  |
| Joined: 19 Sep 2008 |
| Total Posts: 369 |
|
|
| 23 Feb 2013 10:23 AM |
| I wrote code on the fly, check it works :P |
|
|
| Report Abuse |
|
|
|
| 23 Feb 2013 12:45 PM |
| The if statement isn't working. It just creates a body velocity in the torso and the humanoid flys away. |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Feb 2013 01:09 PM |
I'm a fail in scripting but try this:
while true do if script.Parent.Humanoid.Health == 3000 then local bv = Instance.new("BodyVelocity") by.maxForce = (4000, 4000, 4000) by.P = 1250 by.velocity = Vector3.new(0, 10, 0) by.Parent = script.Parent.Torso end
(What is P a variable of?)
|
|
|
| Report Abuse |
|
|
|
| 23 Feb 2013 01:09 PM |
Sorry, I replaced all the v's with y's on accident. Change them back then test it. |
|
|
| Report Abuse |
|
|
noah
|
  |
| Joined: 11 Sep 2006 |
| Total Posts: 18977 |
|
|
| 23 Feb 2013 01:12 PM |
| Where is the script located in? |
|
|
| Report Abuse |
|
|
|
| 23 Feb 2013 01:16 PM |
@ noah if this guy is trying to test it out first, then he should put it in a block with a humanoid |
|
|
| Report Abuse |
|
|
| |
|
Reece709
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 707 |
|
|
| 23 Feb 2013 05:47 PM |
| Not that it's any of my business, but why do you want a humanoid to fly away? :s |
|
|
| Report Abuse |
|
|
|
| 23 Feb 2013 05:50 PM |
| I'm making an RPG, and I want one of the bosses to fly away when he has less than 3,00 hit points left. |
|
|
| Report Abuse |
|
|
noone334
|
  |
| Joined: 02 Aug 2011 |
| Total Posts: 2454 |
|
|
| 23 Feb 2013 05:53 PM |
Try this, put in in a part that's inside the humanoid.
if script.Parent.Parent.Humanoid.Health <= 3000 then while true do wait(0.5) local bv = Instance.new("BodyVelocity") bv.maxForce = Vector3.new(4000, 4000, 4000) bv.P = 1250 bv.velocity = Vector3.new(0, 10, 0) bv.Parent = script.Parent.Parent.Torso end end |
|
|
| Report Abuse |
|
|
|
| 23 Feb 2013 05:55 PM |
| Wouldn't that keep creating new body velocities though? |
|
|
| Report Abuse |
|
|
UnAdmin
|
  |
| Joined: 10 Jul 2012 |
| Total Posts: 4706 |
|
|
| 23 Feb 2013 05:56 PM |
Yes.
~ᴬᴵᴺ'ᵀ ᵀᴴᴬᵀ ᴬ ᴷᴵᶜᴷ ᴵᴺ ᵀᴴᴱ ᴴᴱᴬᴰˑ~ |
|
|
| Report Abuse |
|
|
UnAdmin
|
  |
| Joined: 10 Jul 2012 |
| Total Posts: 4706 |
|
|
| 23 Feb 2013 05:57 PM |
if script.Parent.Humanoid.Health <= 3000 then local bv = Instance.new("BodyVelocity",script.Parent.Torso) bv.maxForce = Vector3.new(4000, 4000, 4000) bv.P = 1250 bv.Velocity = Vector3.new(0, 10, 0) end ~ᴬᴵᴺ'ᵀ ᵀᴴᴬᵀ ᴬ ᴷᴵᶜᴷ ᴵᴺ ᵀᴴᴱ ᴴᴱᴬᴰˑ~ |
|
|
| Report Abuse |
|
|
noone334
|
  |
| Joined: 02 Aug 2011 |
| Total Posts: 2454 |
|
|
| 23 Feb 2013 05:58 PM |
Oops. :P Would something like this be what you're looking for?
if script.Parent.Parent.Humanoid.Health <= 3000 then wait(0.5) local bv = Instance.new("BodyVelocity") bv.maxForce = Vector3.new(4000, 4000, 4000) bv.velocity = Vector3.new(0, 10, 0) bv.Parent = script.Parent.Parent.Torso end |
|
|
| Report Abuse |
|
|
| |
|