|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|