Toggling Between Day/Night Mode with UI: Partial Script Failure

Hi all, I am adding the means to locally change between day and night settings within one of my games.

The buttons to activate the change work fine (i.e. the Day/Night UI), and it partially works. However, part of the script seems to be failing — particularly the lines that regard changes with color (such as Ambience, ColorShift_Bottom, etc.). When I hit night mode, not all of the changes are made that I’ve entered into the script (some functions key to day mode remain).

Toggling back into day mode, it ends up looking like this:

Here is the current code I am working with. It is the same for both the Day/Night modes, but of course with different variables.

script.Parent.MouseButton1Click:Connect(function()
	game.Lighting.ClockTime=14
	game.Lighting.Atmosphere.Color=Color3.fromRGB("0.839216, 0.803922, 0.905882")
	game.Lighting.Atmosphere.Decay=Color3.fromRGB("0.886275, 0.894118, 0.933333")
	game.Lighting.Sky.SunAngularSize=6
	game.Lighting.Atmosphere.Glare=0.42
	game.Lighting.Atmosphere.Haze=2.07
	game.Lighting.Sky.CelestialBodiesShown=false
	game.Lighting.Bloom.Size=30
	game.Lighting.Bloom.Threshold=2.048
	game.Lighting.Bloom.Intensity=0.5
	game.Lighting.Blur=0
game.Lighting.ColorCorrectionEffect.TintColor.Color3=Color3.fromRGB("0.941176, 0.901961, 0.878431")
	game.Lighting.ColorCorrectionEffect.Contrast=0
	game.Lighting.ColorCorrectionEffect.Saturation=0
	game.Lighting.ColorCorrectionEffect.Brightness=0.06
	game.Lighting.DepthOfFieldEffect.FarIntensity=0.951
	game.Lighting.DepthOfFieldEffect.InFocusRadius=39.025
	game.Lighting.DepthOfFieldEffect.NearIntensity=0
	game.Lighting.DepthOfFieldEffect.FocusDistance=124.4
	game.Lighting.SunRaysEffect.Intensity=0.049
	game.Lighting.SunRaysEffect.Spread=0.11
	game.Lighting.Ambient.Color3=Color3.fromRGB("0.447059, 0.439216, 0.533333")
	game.Lighting.Brightness=0.5
	game.Lighting.EnvironmentDiffuseScale=0.5
	game.Lighting.EnvironmentSpecularScale=0.5
	game.Lighting.OutdoorAmbient.Color3=Color3.fromRGB("0.301961, 0.301961, 0.356863")
	game.Lighting.ColorShift_Top.Color3=Color3.fromRGB("0.929412, 1, 0.94902")
	game.Lighting.ColorShift_Bottom.Color3=Color3.fromRGB("0.262745, 0.258824, 0.313725")
	game.Lighting.ShadowSoftness=0.1
	game.Lighting.GeographicLatitude=57.395
	game.Lighting.TimeOfDay=14
end)

Here is where the script is located within the game, underlined in red:
Location of Scripts Within Studio

This is how it is found
Step 1) Open Settings (the buttons are not visible upon joining)
Step 1

Step 2) Toggle Between Modes by Clicking Day or Night Mode (by hitting the arrow again, all buttons in the menu will disappear).

color 3 value is not a string so change all of this

game.Lighting.Ambient.Color3=Color3.fromRGB("0.447059, 0.439216, 0.533333")

to this

game.Lighting.Ambient.Color3=Color3.fromRGB(0.447059, 0.439216, 0.533333)

you have to remove all of the double quote things in your color3 value

2 Likes

Thanks, I removed these. However, it seems to still not be correctly working unfortunately, and gives me the same result pictured before. I am not sure what else may be causing this issue.

try changing this

game.Lighting.ColorCorrectionEffect.TintColor.Color3=Color3.fromRGB(0.941176, 0.901961, 0.878431)

to this

game.Lighting.ColorCorrectionEffect.TintColor=Color3.fromRGB(0.941176, 0.901961, 0.878431)
1 Like

That fixed it. Thanks Creeperman16487!

no problem.good luck on ur game!

1 Like