#i want my lightpoles to only "work" at night.

1 messages · Page 1 of 1 (latest)

eternal lion
#

i have tried everything please help 🥺

honest mortar
#

@eternal lion

eternal lion
#

oh okay

#

local Lighting = game:GetService("Lighting")
local streetLightsFolder = workspace:WaitForChild("StreetLights")

local dayLength = 15 -- Duration of day in seconds
local nightLength = 15 -- Duration of night in seconds

local nightStart = 18 -- 6 PM
local nightEnd = 6 -- 6 AM

local function updateLights()
local currentTime = Lighting:GetMinutesAfterMidnight() / 60
for _, lightPole in ipairs(streetLightsFolder:GetChildren()) do
local light = lightPole:FindFirstChildOfClass("Light")
if light then
if currentTime >= nightStart or currentTime < nightEnd then
light.Enabled = true
else
light.Enabled = false
end
end
end
end

while true do
-- Day time: 6 AM to 6 PM
for i = 6 * 60, 18 * 60 do
Lighting:SetMinutesAfterMidnight(i)
updateLights()
wait(dayLength / (12 * 60))
end

-- Night time: 6 PM to 6 AM
for i = 18 * 60, 24 * 60 do
    Lighting:SetMinutesAfterMidnight(i)
    updateLights()
    wait(nightLength / (12 * 60)) 
end
for i = 0, 6 * 60 do
    Lighting:SetMinutesAfterMidnight(i)
    updateLights()
    wait(nightLength / (12 * 60)) 
end

end

#

oh uh

#

and i have puted the lightpoles in a folder

honest mortar
#

yea i highkey dont know everything looks correct

#

u probably misplaced something 😭 🙏

eternal lion
#

hmm

#

can you help me check it out ingame?

honest mortar
#

yea 1s though i have my own issue i gotta post

dreamy timberBOT
#

studio** You are now Level 1! **studio

eternal lion
#

okay doaky

dreamy timberBOT
#

studio** You are now Level 1! **studio

honest mortar
#

im back

eternal lion
#

okay

honest mortar
#

whats your user

#

highkey bro

#

do you mind waiting until tomorrow

#

its like 430 am rn and i have to wake up at 8

#

if you add me ill fs be able to help u tmr

eternal lion
#

k

#

i did

#

or uhh

honest mortar
#

bet just dm me whenever youre available

eternal lion
#

yeah okay

#

bye bye

gray granite
eternal lion
#

huh?

#

oh hm uhhh

#

what do i put there insted?

eternal lion
vernal flint