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: 'then' expected near '='

Previous Thread :: Next Thread 
coolades33 is not online. coolades33
Joined: 15 Sep 2009
Total Posts: 747
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
Mathfreak231 is not online. Mathfreak231
Joined: 21 Jun 2010
Total Posts: 5311
23 Feb 2013 10:12 AM
You have an extra end.
Also, if I'm right, it's <=, not =<.
Report Abuse
noah is online. noah
Joined: 11 Sep 2006
Total Posts: 18977
23 Feb 2013 10:13 AM
<=
Report Abuse
JamG700 is not online. JamG700
Joined: 31 Jan 2009
Total Posts: 906
23 Feb 2013 10:13 AM
if script.Parent.Humanoid.Health < 3000 then
Report Abuse
coolades33 is not online. coolades33
Joined: 15 Sep 2009
Total Posts: 747
23 Feb 2013 10:15 AM
When I changed it to <= I get ')' expected near ',' on line two.
Report Abuse
JamG700 is not online. JamG700
Joined: 31 Jan 2009
Total Posts: 906
23 Feb 2013 10:17 AM
Give us the entire script.
Report Abuse
coolades33 is not online. coolades33
Joined: 15 Sep 2009
Total Posts: 747
23 Feb 2013 10:17 AM
What I posted is the entire script.
Report Abuse
Struanmcd is not online. 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
coolades33 is not online. coolades33
Joined: 15 Sep 2009
Total Posts: 747
23 Feb 2013 10:21 AM
Thank you.
Report Abuse
Struanmcd is not online. 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
coolades33 is not online. coolades33
Joined: 15 Sep 2009
Total Posts: 747
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
coolades33 is not online. coolades33
Joined: 15 Sep 2009
Total Posts: 747
23 Feb 2013 01:05 PM
Help...?
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
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
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
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 is online. noah
Joined: 11 Sep 2006
Total Posts: 18977
23 Feb 2013 01:12 PM
Where is the script located in?
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
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
coolades33 is not online. coolades33
Joined: 15 Sep 2009
Total Posts: 747
23 Feb 2013 05:37 PM
It still won't work.
Report Abuse
Reece709 is not online. 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
coolades33 is not online. coolades33
Joined: 15 Sep 2009
Total Posts: 747
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 is not online. 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
coolades33 is not online. coolades33
Joined: 15 Sep 2009
Total Posts: 747
23 Feb 2013 05:55 PM
Wouldn't that keep creating new body velocities though?
Report Abuse
UnAdmin is not online. UnAdmin
Joined: 10 Jul 2012
Total Posts: 4706
23 Feb 2013 05:56 PM
Yes.

~ᴬᴵᴺ'ᵀ ᵀᴴᴬᵀ ᴬ ᴷᴵᶜᴷ ᴵᴺ ᵀᴴᴱ ᴴᴱᴬᴰˑ~
Report Abuse
UnAdmin is not online. 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 is not online. 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
coolades33 is not online. coolades33
Joined: 15 Sep 2009
Total Posts: 747
23 Feb 2013 05:59 PM
Thank you everyone.
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