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

My lights won't turn off at night?

Asked by 7 years ago

So basicly, I've been working on my prison game, but the lights for the yard won't turn off at the night. The material changes great. Here's the script:

while true do wait(5)


for i, v in pairs(game.Workspace:GetChildren()) do
    if v.Name == "NeonPart" then
        v.Material = "Neon"
    elseif v.Name == "LightPart" then
        v.SpotLight.Enabled = true
    end
end

game.Lighting.TimeOfDay = "00:00:00"
game.Lighting.GlobalShadows = false
wait(5)

for i, v in pairs(game.Workspace:GetChildren()) do
    if v.Name == "NeonPart" then
        v.Material = "SmoothPlastic"
    elseif v.Name == "LightPart" then
        v.SpotLight.Enabled = false
    end
end

game.Lighting.TimeOfDay = "12:00:00"
game.Lighting.GlobalShadows = true
end

Please note when giving answer, I'm still a beginner with scripting

0
I'm in a hurry right now, so i'll make a quick question for you to answer: Were there any errors in the output window? It'd help if there were some errors so you can identify the problem more easily. (If you don't know where the output window is, click 'VIEW' on the tabs at the top, then click the output bar button) khfong71 10 — 7y
0
I'd suggest looking into GetMinutesAfterMidnight in the wiki. I am sorry, I am in a hurry now, but I think that will put you on the right track to solving your problem. M39a9am3R 3210 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Uh, I just woke up but it doesn't seen like you even checked if the it was night or day..

if game.Lightning.TimeOfDay == "00:00:00" then
--On.. etc
end
0
I don't think he is doing that, he seems to be changing the time himself, then changing the properties. User#13152 0 — 7y
0
That says lightning lol Inpolite 44 — 7y
Ad

Answer this question