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: Stacking anonymous (right word?) conditionals

Previous Thread :: Next Thread 
MikeAnIkes is not online. MikeAnIkes
Joined: 13 Mar 2010
Total Posts: 1581
17 Aug 2013 12:26 AM
I'm guessing anonymous isn't right, but I didn't know their name. I'm referring to conditionals like the following example:

local number = Workspace.Part.BrickColor == BrickColor.new("Really red") and 1 or 0

I'm wondering what the right way would be to get multiple stacked if statements into that, like this ('-' indents for readability):

local default = 0
if Workspace.Part.BrickColor == BrickColor.new("Really red") then
--number = 0
else
--if Workspace.Part.Shape == "Ball" then
----number = 1
--else
----number = 2
--end
end

Sorry for the awful example :|
Feel free to use whatever conditions you want, I can interpret.

~ Oh, I'm sorry, did I break your concentration? ~
Report Abuse
ToboboT is not online. ToboboT
Joined: 25 Jun 2011
Total Posts: 2385
17 Aug 2013 12:29 AM
I don't understand what you want to do? Do you want to make random statements? Or I don't know.
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
17 Aug 2013 12:30 AM
I'm assuming this is what you're after?

local Part = Workspace.Part
local Number = Part.BrickColor == BrickColor.new("Really red") and 0 or Workspace.Part.Shape == "Ball" and 1 or 2

Report Abuse
MikeAnIkes is not online. MikeAnIkes
Joined: 13 Mar 2010
Total Posts: 1581
17 Aug 2013 12:30 AM
If you don't understand this concept:
http://wiki.roblox.com/index.php/Conditional_statement#Advanced_Usage
you can't really help me here.

~ Oh, I'm sorry, did I break your concentration? ~
Report Abuse
MikeAnIkes is not online. MikeAnIkes
Joined: 13 Mar 2010
Total Posts: 1581
17 Aug 2013 12:31 AM
@Desperian
Probably, I'll have to test it later. Thanks!

~ Oh, I'm sorry, did I break your concentration? ~
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
17 Aug 2013 12:34 AM
Actually...

local Part = Workspace.Part
local Number = Part.BrickColor == BrickColor.new("Really red") and 0 or Part.Shape == Enum.PartType.Ball and 1 or 2

The first one was semi-defective.
Report Abuse
MikeAnIkes is not online. MikeAnIkes
Joined: 13 Mar 2010
Total Posts: 1581
17 Aug 2013 12:42 AM
It's alright, it was just an example, I'm not actually checking BrickColor and Shape :P
But yeah, I ran into that error when I made a resizer for models. Took me forever to figure it out, felt like an idiot.

~ Oh, I'm sorry, did I break your concentration? ~
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