Hi! I wanted to make the music change day and night. I made a script like that, but ‘Sound2’ doesn’t change after 6:30 PM and ‘Sound1’ plays all the time without stopping. How to fix it? (The sounds are the children of the script)
‘’’
local lighting = game:GetService(“Lighting”)
local sound1 = script:WaitForChild(“Sound1”)
local sound2 = script:WaitForChild(“Sound2”)
sound1.Looped = true
sound2.Looped = true
sound1:Play()
local function onTimeChanged()
if Lighting.ClockTime == “18:30:00” then
sound1:Stop()
wait(.1)
sound2:Play()
elseif lighting.ClockTime == “07:00” then
sound2:Stop()
wait(.1)
sound1:Play()
end
end
lighting:GetPropertyChangedSignal(“ClockTime”):Connect(onTimeChanged)
‘’’