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: Making do once sth in loop

Previous Thread :: Next Thread 
Aerr0w is not online. 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 is not online. Aerr0w
Joined: 09 Apr 2009
Total Posts: 565
22 Jul 2013 11:10 AM
Bump.
Report Abuse
Java3D is not online. 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 is not online. Aerr0w
Joined: 09 Apr 2009
Total Posts: 565
22 Jul 2013 11:13 AM
It is math random.
Report Abuse
Java3D is not online. 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 is not online. 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 is not online. Aerr0w
Joined: 09 Apr 2009
Total Posts: 565
22 Jul 2013 11:25 AM
Bumpy bump
Report Abuse
Aerr0w is not online. Aerr0w
Joined: 09 Apr 2009
Total Posts: 565
22 Jul 2013 11:29 AM
Bump, help please.
Report Abuse
Frostglacier is not online. Frostglacier
Joined: 28 Oct 2010
Total Posts: 4177
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 is not online. 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
Frostglacier is not online. Frostglacier
Joined: 28 Oct 2010
Total Posts: 4177
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 is not online. 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 is not online. 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
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