So, I have a script that's suppose to enable other scripts when its day or night. It won't work, I have a script that changes the time every .1 seconds, so I know that's not the problem. Am I not suppose to check the Clock Time, or am I suppose to use a normal script? Then, I have 2 other scripts that enable the scripts that actually do something, when the event fires. But, it's still not working anyway.
This is my code, in a local script.
while true do
local Event = game.ReplicatedStorage.Events
wait()
if game.Lighting.ClockTime >= 6.6 then
if game.Lighting.ClockTime < 17.7 then
Event.dayenable:FireServer()
end
end
if game.Lighting.ClockTime <= 6.6 then
if game.Lighting.ClockTime > 17.7 then
Event.spawn2:FireServer()
end
end
end
Second script, thats a normal one
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage.Events:WaitForChild("dayenable")
local function Enable()
script.Parent.Day.Disabled = false
end
remoteEvent.OnServerEvent:Connect(Enable)

3 comments
Is there a reason why you need the ClockTime check in a localscript. The game clock is synced for all players.
I don't know how to access it.
I know to change it, I have to use minutes after midnight. But I don't know how to check it in a local script.