Window changing color and material when It's day/night

Hello Developers. Aymoc here.
I’m a builder of an upcoming streets game and I need help with a very simple task but not for me apparently.
So here I am without the coders of the game alone building the city.
Ignore the quality of the window but it’s just a placeholder for now. I just want to learn for my future games.

image

So I’ve come up with something. I want to make the window change color and material every time It switches between day and night, or the other way.
Right now I’m using realism mod.

Link to the plugin.
Realism Mod
image

The day is 8 minutes and the night is 6 minutes.

Night color and material:
RGB/Hex: 248, 217, 109
Material: Neon
Transparency: 0
Reflectance: 0

Day color and material:
RGB/Hex: 63, 94, 89
Material: Glass
Transparency: 0
Reflectance: 0.2

If anyone is up please explain and help me with the code in the comments.
image

Looking forward to getting responses.
:smiley:

2 Likes

here parent this into the glowy thing and it should work

local window = script.Parent
local lighting = game.Lighting
game.Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
	if lighting.ClockTime >= 17.6 or lighting.ClockTime <= 6.3 then
		window.Color = Color3.fromRGB(248,217,109)
		window.Material = Enum.Material.Neon
		window.Transparency = 0
		window.Reflectance = 0
	else
		window.Color = Color3.fromRGB(63,94,89)
		window.Material = Enum.Material.Glass
		window.Transparency = 0
		window.Reflectance = 0.2
	end
end)
3 Likes