So I want it to where if it's a certain part of the day, it will play a certain song. For some reason this isn't working. Does anyone see anything wrong with the script? Nothing errors, just nothing happens.
This is a LocalScript, and is located in StarterGui.
while true do
wait(1)
if game.Lighting.TimeOfDay > ("6:00:00") and game.Lighting.TimeOfDay < ("12:00:00") then
script.Parent.Midnight2:Stop()
script.Parent.Daytime1:Play()
end
if game.Lighting.TimeOfDay > ("12:00:00") and game.Lighting.TimeOfDay < ("18:00:00") then
script.Parent.Daytime1:Stop()
script.Parent.Daytime2:Play()
end
if game.Lighting.TimeOfDay > ("18:00:00") and game.Lighting.TimeOfDay < ("24:00:00") then
script.Parent.Daytime2:Stop()
script.Parent.Midnight1:Play()
end
if game.Lighting.TimeOfDay > ("24:00:00") and game.Lighting.TimeOfDay < ("6:00:00") then
script.Parent.Midnight1:Stop()
script.Parent.Midnight2:Play()
end
end

3 comments
TimeOfDay is a string... This does work but your logic is wrong.
This didn't work, like Thundermaker300 said TimeOfDay is a string.
If TimeOfDay is a string, couldn't you replace the > and < symbols with "==" and change the times so the music doesn't overlap?