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

BrickColor is not changing?

I think I'm starting to get the hang of scripting, but for some reason, the brick wont change colors. Please help

if game.Lighting.TimeOfDay >= "18:00:00" then
	script.Parent.BrickColor = BrickColor.new("Yellow") elseif
	game.Lighting.TimeOfDay >= "6:00:00" then
		script.Parent.BrickColor = BrickColor.new("Really Black")
		
end

1 answer

Neither Yellow nor Really Black are colors, there's Really yellow or New Yeller as well as Really black. (The capitalisation is key)

If you're checking the time of day, you may want to put the code into a function using the Changed event to check the current TimeOfDay, when it changes.

You could write this as:

game.Lighting.Changed:connect(function()
	if game.Lighting.TimeOfDay >= "18:00:00" then
		script.Parent.BrickColor = BrickColor.new("Really yellow") elseif
		game.Lighting.TimeOfDay >= "6:00:00" then
		script.Parent.BrickColor = BrickColor.new("Really black")
	end
end)

1 comment

0

Oh. :l

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