Everything works fine but after "Back Normal" Everything is just white when i toke the lightning before it changes. I mean when i change it is white when default you see normal colors. (Test it out) Whats wrong?
local A = "event1" local Time = game.Lighting --Time local Br = game.Lighting --Brightness local OA = game.Lighting --OutdoorAmbient local SC = game.Lighting --ShadowColor local fogC = game.Lighting --FogColor local FoEnd = game.Lighting --FogEnd local FoSt = game.Lighting --FogStart game.Players.PlayerAdded:wait() while true do wait (20) game.Lighting:findFirstChild(A):clone().Parent = game.Workspace Time.TimeOfDay = "00:00:00" Br.Brightness = 0.001 OA.OutdoorAmbient = Color3.new(0, 0, 0) SC.ShadowColor = Color3.new(0, 0, 0) fogC.FogColor = Color3.new(0, 0, 0) FoEnd.FogEnd = 75 FoSt.FogStart = 0 wait (10) --Back normal Time.TimeOfDay = "14:00:00" Br.Brightness = 1.0 OA.OutdoorAmbient = Color3.new(127, 127, 127) --This does not change whats wrong? SC.ShadowColor = Color3.new(178, 178, 183) --This does not change whats wrong? fogC.FogColor = Color3.new(75, 75, 75) --This does not change whats wrong? FoEnd.FogEnd = 3000 FoSt.FogStart = 0 game.Workspace:findFirstChild(A):remove() end
What you're doing incorrectly is creating the Color3 values.
local A = "event1" local Lighting = game.Lighting game.Players.PlayerAdded:wait() while true do wait (2) Lighting:FindFirstChild(A):Clone().Parent = game.Workspace Lighting.TimeOfDay = "00:00:00" Lighting.Ambient = Color3.new(0, 0, 0) Lighting.Brightness = 0.001 Lighting.ColorShift_Bottom = Color3.new(0, 0, 0) Lighting.ColorShift_Top = Color3.new(0, 0, 0) Lighting.OutdoorAmbient = Color3.new(0, 0, 0) Lighting.ShadowColor = Color3.new(0, 0, 0) Lighting.FogColor = Color3.new(0, 0, 0) Lighting.FogEnd = 75 Lighting.FogStart = 0 wait (1) Lighting.TimeOfDay = "12:00:00" Lighting.Ambient = Color3.new(0, 0, 0) Lighting.Brightness = 1 Lighting.ColorShift_Bottom = Color3.new(0, 0, 0) Lighting.ColorShift_Top = Color3.new(0, 0, 0) Lighting.OutdoorAmbient = Color3.new(127/255, 127/255, 127/255) Lighting.ShadowColor = Color3.new(178/255, 178/255, 183/255) Lighting.FogColor = Color3.new(191/255, 191/255, 191/255) Lighting.FogEnd = 100000 Lighting.FogStart = 0 game.Workspace:FindFirstChild(A):Destroy() end
Here's a rundown of what changed:
Firstly, I changed all of those variable names that referenced game.Lighting to one variable: Lighting. All of those variables weren't necessary, and lessened the readability of the script.
Next, I changed the first line of the while loop, which was:
game.Lighting:findFirstChild(A):clone().Parent = game.Workspace
to this:
Lighting:FindFirstChild(A):Clone().Parent = game.Workspace
Firstly, I changed the variable that's being referenced to "Lighting", instead of game.Lighting, since we already have a variable for Lighting.
It also now uses "FindFirstChild", not "findFirstChild" (notice the case difference) since "findFirstChild" is deprecated, as well as "Clone" instead of "clone", since "clone" is also deprecated.
The main thing that I changed is the Color3.new lines in the second part of the code. You were creating Color3 values with raw numbers. The Color3 library actually takes colors as a decimal out of 1. So, you have to divide the values you want by 255 in order to get the desired result.
I changed this line
game.Workspace:findFirstChild(A):remove()
to this, which doesn't have deprecated functions:
game.Workspace:FindFirstChild(A):Destroy()
Lastly, if you want to get really advanced with how you're doing this, I'd suggest the following solution as a more easily configurable alternative:
local A = "event1" local Lighting = game.Lighting game.Players.PlayerAdded:wait() local initialLighting = { TimeOfDay = "12:00:00", Ambient = Color3.new(0, 0, 0), Brightness = 1, ColorShift_Bottom = Color3.new(0, 0, 0), ColorShift_Top = Color3.new(0, 0, 0), OutdoorAmbient = Color3.new(127/255, 127/255, 127/255), ShadowColor = Color3.new(178/255, 178/255, 183/255), FogColor = Color3.new(191/255, 191/255, 191/255), FogEnd = 100000, FogStart = 0 } local darkerLighting = { TimeOfDay = "00:00:00", Ambient = Color3.new(0, 0, 0), Brightness = 0.001, ColorShift_Bottom = Color3.new(0, 0, 0), ColorShift_Top = Color3.new(0, 0, 0), OutdoorAmbient = Color3.new(0, 0, 0), ShadowColor = Color3.new(0, 0, 0), FogColor = Color3.new(0, 0, 0), FogEnd = 75, FogStart = 0 } while true do wait (2) Lighting:FindFirstChild(A):Clone().Parent = game.Workspace for property, value in pairs(darkerLighting) do Lighting[property] = value end wait (1) for property, value in pairs(initialLighting) do Lighting[property] = value end game.Workspace:FindFirstChild(A):Destroy() end
Essentially, what this does is create two tables of various states of Lighting, using a key-value format that represents a property and its value. When the time comes to set the Lighting properties to various values, a for loop iterates through all of the properties and their values, assigning the property to its corresponding value in Lighting.
Hope this helps. Good luck!