Hey there! Recently, I've started working on an rpg style game, and I'm having a hard time with ClockTime. Honestly, I'm a terrible scripter so I have no idea what I did wrong. I had put a Day/Night cycle script in, and started working on this script, which is supposed to make a Gate invisible in the daytime, and visible in night. My problem though, is that whenever I try to assign the ClockTime value, it says it's invalid and won't work when I test it. It's at the 'if ClockTime = 6 then' part. Sorry if this is really obvious, but like I said earlier Im kind of a garbage script so I don't really know what I did wrong.
local ClockTime = game.Lighting.ClockTime
if ClockTime = 6 then
game.Workspace.StarterTownEntrance.Gate_Metal.Transparency = 1
game.Workspace.StarterTownEntrance.Gate_Metal.CanCollide = true
game.Workspace.StarterTownEntrance.Gate_Wood.Transparency = 1
game.Workspace.StarterTownEntrance.Gate_Wood.CanCollide = true
end
if ClockTime = 18 then
game.Workspace.StarterTownEntrance.Gate_Metal.Transparency = 0
game.Workspace.StarterTownEntrance.Gate_Metal.CanCollide = false
game.Workspace.StarterTownEntrance.Gate_Wood.Transparency = 0
game.Workspace.StarterTownEntrance.Gate_Wood.CanCollide = false
end

8 comments
I guess I'm sort of confused. ClockTime.Value? I thought ClockTime was it's own value. Like Transparency for example. When you want to change the value of transparency you just type game.Workspace.Part.Transparency = 1
Also, does the type of script matter, and where it's placed? I used a regular script and placed it in Workspace
Sorry for confusing you, I thought
ClockTimewas an int/number value in the Lighting. I editted the answer, check it out.Use While true do for infinite loops..
^ I added a wait() so it wouldn't crash, it is still an infinite loop, are you dumb?
If your doing 'if' you must put two equals, or it will not work, eg:
ew wait() as a condition. Don't ever do that!!!
No I wanna use wait().