Im making a magic crystal, that when the game reaches a determined hour, the color of the crystal will change, i made a script with my small knowledges about scripting for do it, but seems that is a failure in it.
Here is the code that the crystal uses
if game.Lighting.ClockTime == ("6.12") then script.parent.BrickColor.new = ("Really Blue") end if game.Lighting.TimeOfDay == ("06:06:00") then script.parent.BrickColor.new = ("Deep Orange") end
You need to be constantly checking. Do:
while true do if game.Lighting.ClockTime == ("6.12") then script.parent.BrickColor.new = ("Really Blue") end if game.Lighting.TimeOfDay == ("06:06:00") then script.parent.BrickColor.new = ("Deep Orange") end wait() end
When changing the brick color of a part, you have to do something like this: part.BrickColor = BrickColor.new("Really Blue")
So an easy fix to your script is to change the "script.Parent.BrickColor.new =" to script.Parent.BrickColor = BrickColor.new("Color")
Furthermore, brickcolors are case-sensitive. You wrote "Really Blue". This has to be written as "Really blue" - with lowercase "b". Same with "Deep Orange" --> "Deep orange"
if game.Lighting.ClockTime == ("6.12") then script.parent.BrickColor = BrickColor.new("Really blue") end if game.Lighting.TimeOfDay == ("06:06:00") then script.parent.BrickColor = BrickColor.new("Deep orange") end
But this check only runs once, which means you need some kind of loop to constantly check the ClockTime and TimeOfDay. You could use :GetPropertyChangedSignal() to do a check every time "TimeOfDay" or "ClockTime" changes, or you could make a while loop to constantly check these properties.
I believe that's all. If you got any questions or suggestions on improvements I can make, feel free to comment on this answer. (:
~Sethex, aka. TheWaterFoox