Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

BrickColor is not changing?

Asked by 10 years ago

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

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

1 answer

Log in to vote
2
Answered by
Wizzy011 245 Moderation Voter
10 years ago

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:

1game.Lighting.Changed:connect(function()
2    if game.Lighting.TimeOfDay >= "18:00:00" then
3        script.Parent.BrickColor = BrickColor.new("Really yellow") elseif
4        game.Lighting.TimeOfDay >= "6:00:00" then
5        script.Parent.BrickColor = BrickColor.new("Really black")
6    end
7end)
0
Oh. :l branflakes1099 30 — 10y
Ad

Answer this question