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

My script didn't work? [closed]

Asked by
Prioxis 673 Moderation Voter
10 years ago

Here is the script

while true do
    wait()
    if game.Lighting.TimeOfDayLsub(1,3) == "18:" then
        script.Parent.SpotLight.Enabled = true
    end
    if game.Lighting.TimeOfDayLsub(1,3) == "07:" then
        script.Parent.SpotLight.Enabled = false
    end
end

whenever it reaches 18:00:00 or anytime during 18:00:00 it doesn't turn on the light?

Marked as Duplicate by TheeDeathCaster, HexC3D, M39a9am3R, and Articulating

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?

1 answer

Log in to vote
1
Answered by 10 years ago

What's TimeOfDayLsub? I think you meant to write this...

while true do
    wait()
    if game.Lighting.TimeOfDay:sub(1,3) == "18:" then
        script.Parent.SpotLight.Enabled = true
    end
    if game.Lighting.TimeOfDay:sub(1,3) == "07:" then
        script.Parent.SpotLight.Enabled = false
    end
end


0
Yay thank you :D Prioxis 673 — 10y
0
No problem. :) mrgeorge12345 45 — 10y
Ad