I’m having a small problem; My script which is supposed to turn off lights at one single time (6:30 am using the roblox ClockTime); I know i’m supposed to use a coroutine (I did actually, I’m new to using those so I have no idea if it’s that’s the problem)
What are you trying to get?
A script which turns on a spotlight and turns on an effect at around 18.1 (roblox clocktime; of course.) until 6.3.
What’s wrong?
The Bottom Line, that turns off the light when it’s above 6.3.
The Script itself:
--// Locals
local LightEffect = script.Parent.LightEffect.light
local SpotLight = script.Parent.Parent.LightPart.SpotLight
--// Main
local thread_Off = coroutine.create(function()
while true do
wait(0.5)
if game.Lighting.ClockTime > 6.3 then
LightEffect.Enabled = false
SpotLight.Enabled = false
SpotLight.Parent.BrickColor = BrickColor.new("Dark stone grey")
SpotLight.Parent.Material = Enum.Material.SmoothPlastic
end
end
end)
while true do
wait(0.5)
if game.Lighting.ClockTime > 18.1 then
LightEffect.Enabled = true
SpotLight.Enabled = true
SpotLight.Parent.BrickColor = BrickColor.new("Institutional white")
SpotLight.Parent.Material = Enum.Material.Neon
end
end
coroutine.resume(thread_Off)