How would I edit my script to turn these things back on at 7 clocktime instea of what it is

I have this script that allows me to turn of and on a teleport with a surfacegui, but it turns back on at 0, I want it turn back on at 7. Anyone help? Here is the script

local Lighting = game:GetService("Lighting");

while true do

if Lighting.ClockTime >= 18 then

    script.Parent.Selectable = false
script.Parent.Visible = false
script.Parent.Parent.Parent.Parent.Rarity.Value = "Sorry, we are currently closed"
game.Workspace.StoreBarberSign.Decal.Transparency = 0.9

    else

    script.Parent.Selectable = true
script.Parent.Visible = true
script.Parent.Parent.Parent.Parent.Rarity.Value = "Click To Enter The Barber Shop"
game.Workspace.StoreBarberSign.Decal.Transparency = 0
end

wait(1) 
end

I updated your logic a little to be more efficient, also fixes your problem with turning on at 0 instead of 7:

local teleporterOn = false
while true do
    if 
        teleporterOn and 
        (Lighting.ClockTime < 7 or Lighting.ClockTime >= 18) 
    then

        teleporterOn = false
        -- turn off teleporter

    elseif 
        not teleporterOn and 
        (Lighting.ClockTime >= 7 and Lighting.ClockTime < 18) 
    then

        teleporterOn = true
        -- turn on teleporter

    end
    wait(1)
end
1 Like

I will test this right now. Character30

Ahhhh yes, this works perfectly, thank you.