Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

This script does not change the part's color when game.Lighting.ClockTime is 17?

Hey!

Thank you for taking your time out of my day to help me with this.

I have a building. I also got a script (located ServerScriptService). That script should make the building's windows change color whenever Lighting's ClockTime reaches 17 to make it seem like it's lit up. Then when Lighting's ClockTime reaches 07, it should change the part's reflectance.

This script doesn't seem to work though!

New to coding, so any help would be appreciated!

Code:

Lighting = game.Lighting
Map = game.Workspace

while true do

if game.Lighting.ClockTime == 17 then
	Map.Bank.WindowDetail.Reflectance = 0
		Map.Bank.WindowDetail.BrickColor = BrickColor.new ("Cool yellow")
end

	if game.Lighting.Lighting.ClockTime == 07 then
		Map.Bank.WindowDetail.Refelctance = 1
end

end

1 answer

✓ Accepted answer

Try this:

Lighting = game.Lighting
Map = game.Workspace

while wait() do

	if game.Lighting.ClockTime == 17 then
		for _, window in pairs(Map.Bank:GetDescendants()) do
			if window.Name == "WindowDetail" then
				window.Reflectance = 0
				window.BrickColor = BrickColor.new ("Cool yellow")
			end
		end
	end

	if game.Lighting.ClockTime == 07 then
		for _, window in pairs(Map.Bank:GetDescendants()) do
			if window.Name == "WindowDetail" then
				window.Refelctance = 1
			end
		end
	end

end

This discussion is preserved as it was. New answers, comments, and votes are closed.