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: Adding 0.5

Previous Thread :: Next Thread 
BlizardAlpha is not online. BlizardAlpha
Joined: 23 Aug 2012
Total Posts: 753
09 Nov 2012 11:02 AM
So, I want to do

while true do
game.Lighting.Brightness=(1)
wait(20)
-- I want to minus 0.05 from this after 20 seconds.
end
Report Abuse
BlizardAlpha is not online. BlizardAlpha
Joined: 23 Aug 2012
Total Posts: 753
09 Nov 2012 11:02 AM
Oops!


while true do
game.Lighting.Brightness=1
wait(20)
-- I want to minus 0.05 from this after 20 seconds.
end
Report Abuse
triston220 is not online. triston220
Joined: 08 Mar 2010
Total Posts: 1861
09 Nov 2012 11:07 AM
while true do
game.Lighting.Brightness = (game.Lighting.Brightness - 0.05)
wait(20)
end
Report Abuse
BlizardAlpha is not online. BlizardAlpha
Joined: 23 Aug 2012
Total Posts: 753
09 Nov 2012 11:10 AM
Thanks!

What about when it gets to say, 0 brightness, start from the top?
Report Abuse
BlizardAlpha is not online. BlizardAlpha
Joined: 23 Aug 2012
Total Posts: 753
09 Nov 2012 11:15 AM
while (1) do

if game.Lighting.Brightness == 0 then
game.Lighting.Brightness = (game.Lighting.Brightness + 0.05)
else
game.Lighting.Brightness = (game.Lighting.Brightness - 0.05)
wait(1)

end

end
Report Abuse
BlizardAlpha is not online. BlizardAlpha
Joined: 23 Aug 2012
Total Posts: 753
09 Nov 2012 11:16 AM
Has el problemo.
Report Abuse
triston220 is not online. triston220
Joined: 08 Mar 2010
Total Posts: 1861
09 Nov 2012 11:33 AM
while true do
If game.Lighting.Brightness == 0 then
game.Lighting.Brightness = 1
end
game.Lighting.Brightness = (game.Lighting.Brightness - 0.05)
wait(20)
end
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
09 Nov 2012 11:34 AM
L = game.Lighting
function run()
while L.Brightness > 0 do
L.Brightness = L.Brightness - .05
end
run()
end
run()


Maybe?
Report Abuse
BlizardAlpha is not online. BlizardAlpha
Joined: 23 Aug 2012
Total Posts: 753
09 Nov 2012 12:17 PM
Enope.
Report Abuse
triston220 is not online. triston220
Joined: 08 Mar 2010
Total Posts: 1861
09 Nov 2012 12:25 PM
while true do
if game.Lighting.Brightness == 0 then
game.Lighting.Brightness = 1
end
game.Lighting.Brightness = (game.Lighting.Brightness - 0.05)
wait(20)
end
Report Abuse
BlizardAlpha is not online. BlizardAlpha
Joined: 23 Aug 2012
Total Posts: 753
09 Nov 2012 12:59 PM
Doesn't work. :/
Report Abuse
triston220 is not online. triston220
Joined: 08 Mar 2010
Total Posts: 1861
09 Nov 2012 01:17 PM
Any output? QQ
What's the current value of game.Lighting.Brightness?
Report Abuse
triston220 is not online. triston220
Joined: 08 Mar 2010
Total Posts: 1861
09 Nov 2012 01:18 PM
You are waiting 20 seconds?

You do realise that the change will be miniscule?
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
09 Nov 2012 02:06 PM
Because of Lua's double value precision , your number well never be exactly equal to zero after you subtract. Use <0.05 I stead of ==0.
Report Abuse
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
09 Nov 2012 02:38 PM
Why not just use a for loop?

local l = game.Lighting
for b = l.Brightness,0,-0.05 do
l.Brightness = b
Wait()
end
Report Abuse
1Topcop is not online. 1Topcop
Joined: 09 Jun 2009
Total Posts: 6635
09 Nov 2012 02:59 PM
crazy has an error O:
He put Wait() not wait() o:
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
09 Nov 2012 03:14 PM
Sigh...
Wait works just like wait.
Please learn up on rbx.Lua
Report Abuse
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
09 Nov 2012 04:01 PM
I prefer to Capitalize all function names, therefore, I will use capitalized global functions if they exist.

wait, Wait
delay, Delay
spawn, Spawn

Some examples that have duplicates.
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