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

Why won't this script work??

Asked by 9 years ago

Hi, I'm just learning Scripting and i did this script as example but it doesn't work:

while true do
wait(1)
game.Workspace.Lighting.TimeOfDay = "00:00:00"
wait(1)
game.Workspace.Lighting.TimeOfDay = "12:00:00"
wait(1)
game.Workspace.Lighting.TimeOfDay = "01:00:00"
end

I don't get why it doesn't work because it got no red checkmarks, nor blue ones, Please help?

Oh i almost forgot to say that in the Output it prints this: 17:47:51.347 - Stack End 17:47:52.364 - Lighting is not a valid member of Workspace 17:47:52.364 - Script 'Workspace.Script1', Line 3 17:47:52.365 - Stack End

0
It is game.Lighting, not game.Workspace. TheDeadlyPanther 2460 — 9y

1 answer

Log in to vote
0
Answered by
dyler3 1510 Moderation Voter
9 years ago

Your problem is that you're trying to access Lighting as a descendant of Workspace. The Lighting property is actually a descendant of the game itself, therefore need to access it using game.Lighting.


If done correctly, your code should look like this:

while true do
    wait(1)
    game.Lighting.TimeOfDay = "00:00:00"
    wait(1)
    game.Lighting.TimeOfDay = "12:00:00"
    wait(1)
    game.Lighting.TimeOfDay = "01:00:00"
end

Ok, well now this should work. If it doesn't, or you have any further problems/questions, please leave a comment below, and I'll see what I can do. Hope I helped :P

-Dyler3

Ad

Answer this question