Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My script didn't work?

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?

1 answer

✓ Accepted answer

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


2 comments

0

Yay thank you :D

0

No problem. :)

This discussion is preserved as it was. New answers, comments, and votes are closed.