Aerr0w
|
  |
| Joined: 09 Apr 2009 |
| Total Posts: 565 |
|
|
| 22 Jul 2013 11:05 AM |
while true do if number == 1 then etc etc etc wait(x) end
I want to add script below to script above. It have to work only once, when number == 1
game.Lighting.Brightness = 0.1
No idea how to do it, help please. |
|
|
| Report Abuse |
|
|
Aerr0w
|
  |
| Joined: 09 Apr 2009 |
| Total Posts: 565 |
|
| |
|
Java3D
|
  |
| Joined: 29 Jul 2012 |
| Total Posts: 1229 |
|
|
| 22 Jul 2013 11:12 AM |
How are you getting number? If it's an IntValue you can do
number.Changed:connect(function(v) game.Lighting.Brightness = v==1 and .1 or 1 end)
If it's just a number variable,
while(wait())do game.Lighting.Brightness = number==1 and .1 or 1 end |
|
|
| Report Abuse |
|
|
Aerr0w
|
  |
| Joined: 09 Apr 2009 |
| Total Posts: 565 |
|
| |
|
Java3D
|
  |
| Joined: 29 Jul 2012 |
| Total Posts: 1229 |
|
|
| 22 Jul 2013 11:14 AM |
while(wait())do game.Lighting.Brightness = math.random(1,2)==1 and .1 or 1 end -- :P |
|
|
| Report Abuse |
|
|
Aerr0w
|
  |
| Joined: 09 Apr 2009 |
| Total Posts: 565 |
|
|
| 22 Jul 2013 11:20 AM |
| What if math.random is on top of the script. etc etc etc have to work infinity times, but script I need to be put must work only once. |
|
|
| Report Abuse |
|
|
Aerr0w
|
  |
| Joined: 09 Apr 2009 |
| Total Posts: 565 |
|
| |
|
Aerr0w
|
  |
| Joined: 09 Apr 2009 |
| Total Posts: 565 |
|
| |
|
|
| 22 Jul 2013 11:38 AM |
while true do execute script here bla bla bla k ran = math.random(1,100) if ran == 1 then game.Lighting.Brightness = 0.1 end wait(x) end
|
|
|
| Report Abuse |
|
|
Aerr0w
|
  |
| Joined: 09 Apr 2009 |
| Total Posts: 565 |
|
|
| 22 Jul 2013 11:41 AM |
| exceture script here bla bla bla k have to work both with game.Lighting.Brighness = 0.1, but game.Lighting... have to work only once, bla bla bla k have to work x times. |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2013 11:44 AM |
I'm a bit confused here.
So, is the concept as follows?
if number == 1 then lighting = 0.1 execute code else execute code
|
|
|
| Report Abuse |
|
|
Aerr0w
|
  |
| Joined: 09 Apr 2009 |
| Total Posts: 565 |
|
|
| 22 Jul 2013 12:01 PM |
| Nope, its broken, but I have to work that way. Execute code ( first one ) have to work only once. Second execute code have to work a lot of times. |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 22 Jul 2013 01:11 PM |
repeat wait() until number == 1 game.Lighting.Brightness = 0.1
Isn't that what you want? |
|
|
| Report Abuse |
|
|