dribson5
|
  |
| Joined: 20 Nov 2010 |
| Total Posts: 31 |
|
|
| 13 Jul 2011 03:49 PM |
and when the brick's color is Really Black, it's supposed to remove the script, thus stopping the disco effect.
The script is removed, but the color keeps changing. How do I fix it? |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2011 03:49 PM |
before you remove the script make it disabled
~ Mitch ~ |
|
|
| Report Abuse |
|
|
dribson5
|
  |
| Joined: 20 Nov 2010 |
| Total Posts: 31 |
|
|
| 13 Jul 2011 03:52 PM |
It doesn't seem to work like that, either. Let me try tinkering with it more until it works. |
|
|
| Report Abuse |
|
|
dribson5
|
  |
| Joined: 20 Nov 2010 |
| Total Posts: 31 |
|
|
| 13 Jul 2011 03:57 PM |
Yeah, the script doesn't like me. Here's the script:
local brick = script.Parent
while true do brick.BrickColor = BrickColor.random() wait(0.25) if brick.BrickColor == BrickColor.new("Really Black") then script.Disabled = true wait(0.0000000009846798423692846298751) script:remove() end end |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2011 03:58 PM |
while true do brick.BrickColor = BrickColor.random() wait(0.25) if brick.BrickColor == BrickColor.new("Really Black") then wait() script:remove() end end |
|
|
| Report Abuse |
|
|
dribson5
|
  |
| Joined: 20 Nov 2010 |
| Total Posts: 31 |
|
|
| 13 Jul 2011 04:00 PM |
@death
That's the same thing as I said about earlier. I need the script to be disabled, but when I try, nothing happens, or the script keeps going and is removed. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2011 04:04 PM |
local brick = script.Parent a = true while a == true do brick.BrickColor = BrickColor.random() wait(0.25) end if brick.BrickColor == BrickColor.new("Really Black") then a = false script:remove() end
Try this and tell me what happens. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2011 04:05 PM |
while true do brick.BrickColor = BrickColor.random() wait(0.25) if brick.BrickColor == BrickColor.new("Really Black") then break end end |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2011 04:07 PM |
Don't if statements glitch up loops?
I was working with a for statement earlier and had to move the if satement outside the for loop because it broke the for loop prematurely. |
|
|
| Report Abuse |
|
|
dribson5
|
  |
| Joined: 20 Nov 2010 |
| Total Posts: 31 |
|
|
| 13 Jul 2011 04:10 PM |
Neither of those work. Neither of those remove the script. Neither of those stop the disco effect.
I can spam paint it Really Black and nothing happpens. |
|
|
| Report Abuse |
|
|
dribson5
|
  |
| Joined: 20 Nov 2010 |
| Total Posts: 31 |
|
|
| 13 Jul 2011 04:11 PM |
"Don't if statements glitch up loops?"
Do they? Probably. I didn't know that. I'll just have to go the boring way... |
|
|
| Report Abuse |
|
|
dekkonot
|
  |
| Joined: 22 Dec 2010 |
| Total Posts: 6685 |
|
|
| 13 Jul 2011 04:12 PM |
while true do brick.BrickColor = BrickColor.random() wait(0.25) if brick.BrickColor == BrickColor.new("Really Black") then break script:remove() end end |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2011 04:12 PM |
while true do brick.BrickColor = BrickColor.random() wait(0.25) if brick.BrickColor == BrickColor.new("Really Black") then wait() break script:remove() end end
I forgot the 'break'. You need to break the loop to cause it to stop. |
|
|
| Report Abuse |
|
|
| |
|
|
| 13 Jul 2011 04:16 PM |
| The if statement isn't running... hmmm |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2011 04:28 PM |
| Maybe use a repeat/until statement istead of while true do. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2011 04:31 PM |
while true do wait()
color = BrickColor.random()
script.Parent.BrickColor = color
if color == BrickColor.new("Really black") then script.Disabled = true break end
end |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2011 04:45 PM |
| You could also make 2 scripts, one with the while true do and one for the id statement. |
|
|
| Report Abuse |
|
|