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

Previous Thread :: Next Thread 
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
02 Jun 2013 03:46 PM
local s = script.Parent

while wait(1/30) do
if game.Lighting.TimeOfDay == "6:00:00" then
s.Lighting.Brightness = 1
s.Lighting.Ambient = 0,0,0
end
if game.Lighting.TimeOfDay == "18:00:00" then
s.Lighting.Brightness = 0
s.Lighting.Ambient = 116,116,116
end

--Does nothing :c no outputs, help??
Report Abuse
ellosss is not online. ellosss
Joined: 15 Mar 2009
Total Posts: 7030
02 Jun 2013 03:49 PM
end
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
02 Jun 2013 03:51 PM
...The ambient and brightness dont change but yea that was one problem :P
Report Abuse
Voidion is not online. Voidion
Joined: 01 Aug 2011
Total Posts: 2668
02 Jun 2013 03:54 PM
Try

s.Lighting.Ambient = Color3.new(116/255, 116/255, 116/255)
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
02 Jun 2013 03:57 PM
Doesn't work
I don't know if it makes any difference but here's the whole script

while true do
game.Lighting:setMinutesAfterMidnight(game.Lighting:getMinutesAfterMidnight()+.25)
wait(.1)
end

local s = script.Parent

while wait(1/30) do
if game.Lighting.TimeOfDay == "6:00:00" then
s.Lighting.Brightness = 1
s.Lighting.Ambient = Color3.new(0/255, 0/255, 0/255)
end
if game.Lighting.TimeOfDay == "18:00:00" then
s.Lighting.Brightness = 0
s.Lighting.Ambient = Color3.new(116/255, 116/255, 116/255)
end
end

Report Abuse
Voidion is not online. Voidion
Joined: 01 Aug 2011
Total Posts: 2668
02 Jun 2013 03:58 PM
Wait, where is this script located? Workspace?
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
02 Jun 2013 03:59 PM
Yea.
Report Abuse
Voidion is not online. Voidion
Joined: 01 Aug 2011
Total Posts: 2668
02 Jun 2013 04:00 PM
... There is no Lighting in Workspace...

game.Lighting.Ambient = Color3.new(116/255, 116/255, 116/255)
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
02 Jun 2013 04:01 PM
Whoops. Its been a long day
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
02 Jun 2013 04:02 PM
Still doesn't change the ambient or brightness
Report Abuse
Voidion is not online. Voidion
Joined: 01 Aug 2011
Total Posts: 2668
02 Jun 2013 04:07 PM
I think its because you have two while loops in the script and only one is running (Because the first while loop is set to run forever).

Use a coroutine!

local Time = coroutine.create(function()
while true do
game.Lighting:setMinutesAfterMidnight(game.Lighting:getMinutesAfterMidnight()+.25)
wait(.1)
end
end)

coroutine.resume(Time)

while wait() do
if game.Lighting.TimeOfDay == "6:00:00" then
game.Lighting.Brightness = 1
game.Lighting.Ambient = Color3.new(0/255, 0/255, 0/255)
elseif game.Lighting.TimeOfDay == "18:00:00" then
game.Lighting.Brightness = 0
game.Lighting.Ambient = Color3.new(116/255, 116/255, 116/255)
end
end
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
02 Jun 2013 04:09 PM
*Gasp!* But... Those are for smart people XD alright well thanks :P
Report Abuse
magnalite is not online. magnalite
Joined: 18 Oct 2009
Total Posts: 2467
02 Jun 2013 04:10 PM
No they are very easy once you have used them once
Report Abuse
Voidion is not online. Voidion
Joined: 01 Aug 2011
Total Posts: 2668
02 Jun 2013 04:11 PM
Coroutines are actually very easy to use, and no problem.
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
02 Jun 2013 04:12 PM
Noooo! It still doesnt work :c scripts hate me i swear
Report Abuse
Voidion is not online. Voidion
Joined: 01 Aug 2011
Total Posts: 2668
02 Jun 2013 04:13 PM
I have no idea why it wouldn't since I made that and tested it in Studio...
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
02 Jun 2013 04:13 PM
Oh wait... just a sec
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
02 Jun 2013 04:15 PM
Yea wait what e.e scripts hate me! D: lol whai it no work :c The script is just in workspace, and not a block or anything?
Report Abuse
Voidion is not online. Voidion
Joined: 01 Aug 2011
Total Posts: 2668
02 Jun 2013 04:23 PM
if game.Lighting.TimeOfDay == "06:00:00" then

Sorry about that... ._.
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
02 Jun 2013 04:24 PM
lol dw i should have seen that :3
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
02 Jun 2013 04:27 PM
It works now thanks so much :D
Report Abuse
ToontownROXYA is not online. ToontownROXYA
Joined: 02 Aug 2010
Total Posts: 434
02 Jun 2013 04:28 PM
Here try this, it may not make a big difference, but I guess it's worth a shot.


lighting = game:GetService("Lighting")

local Time = coroutine.create(function()
while true do
lighting:setMinutesAfterMidnight(lighting:getMinutesAfterMidnight()+.25)
wait(.1)
end
end)

coroutine.resume(Time)

while wait() do
if lighting.TimeOfDay == "6:00:00" then
lighting.Brightness = 1
lighting.Ambient = Color3.new(0/255, 0/255, 0/255)
elseif lighting.TimeOfDay == "18:00:00" then
lighting.Brightness = 0
lighting.Ambient = Color3.new(116/255, 116/255, 116/255)
end
end
Report Abuse
Voidion is not online. Voidion
Joined: 01 Aug 2011
Total Posts: 2668
02 Jun 2013 04:28 PM
ye
Report Abuse
ToontownROXYA is not online. ToontownROXYA
Joined: 02 Aug 2010
Total Posts: 434
02 Jun 2013 04:29 PM
Sorry missed the last few posts >.< Come on, i've made a lens flare, and I even missed that Lol
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
02 Jun 2013 04:30 PM
lol thanks anyway c:
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