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: Can I use elseif like this?

Previous Thread :: Next Thread 
killjoy37 is not online. killjoy37
Joined: 27 Aug 2008
Total Posts: 2821
23 Jun 2012 07:01 PM
if key == "b" and row ~= 1 then
stuff
elseif key == "n" and row ~= 2 then
stuff
elseif key == "m" and row ~= 3 then
stuff
end

Or would I have to use if's on the last two?

key is KeyDown event, and row is a variable that can be either 1, 2, or 3.
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
23 Jun 2012 07:08 PM
No, you can have an unlimited number of elseif's per if statement.
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
23 Jun 2012 07:09 PM
...And as soon as I read my post I realize it's stupidly worded.

I mean: What you have appears to be correct.
Report Abuse
killjoy37 is not online. killjoy37
Joined: 27 Aug 2008
Total Posts: 2821
23 Jun 2012 07:18 PM
Lol, thanks.

At first I was like "Well..."
But then I lol'd
Report Abuse
killjoy37 is not online. killjoy37
Joined: 27 Aug 2008
Total Posts: 2821
23 Jun 2012 07:19 PM
The only reason I was questioning it was because there were two tests that it needed to pass per if statement
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
23 Jun 2012 07:21 PM
You can have unlimited tests per if statement.

Note:

a = true
b = true

if a then
print("a is true")
elseif b then
print("b is true")
else
print("Nothing is true")
end

Will ONLY print "a is true," despite b also being true.
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