So, i’ve made a script that turns off the music in the night, and turns it on in the day, and it’s doesnt seem to work well. Turning it on works, but turning off doesn’t. Here’s my script:
local lighting = game:GetService("Lighting")
local musicon = 6.5*60
local musicoff = 18.5*60
local music = script.Parent.Chill
lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
if lighting:GetMinutesAfterMidnight() > musicon and lighting:GetMinutesAfterMidnight() < musicoff then
if music.Playing == false then
music:Play()
end
elseif lighting:GetMinutesAfterMidnight() > musicoff and lighting:GetMinutesAfterMidnight() < musicon then
script.Parent.Chill:Destroy()
end
end)