I’m trying to make it so a Day ambient sound will play when the Day cycle reaches morning and a Night Ambient sound to play when it reaches after sunset (Sounds and script are in the Bush part)
These are Forest Day and Night Ambient sound effects which will be played at night or day.
Sounds are not playing and there not delayed its just there not playing and its showing no error in the output
I’ve tried Playing.Enabled = true/false and I’ve tried :Play() but nothing worked
while true do
wait(0.1)
if game.Lighting:GetMinutesAfterMidnight() > 6 * 60 then
game.Workspace.Bush.DayForestAmbients.Playing.Enabled = true
game.Workspace.Bush.NightForestAmbients.Playing.Enabled = false
end
print("sound1")
if game.Lighting:GetMinutesAfterMidnight() > 18 * 60 then
game.Workspace.Bush.DayForestAmbients.Playing.Enabled = false
game.Workspace.Bush.NightForestAmbients.Playing.Enabled = true
end
end
local lighting = game:GetService("Lighting")
local bush = workspace:WaitForChild("Bush")
local DFA = bush:WaitForChild("DayForestAmbients")
local NFA = bush:WaitForChild("NightForestAmbients")
lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
if lighting.ClockTime >= 6 and lighting.ClockTime < 18 then
if NFA.IsPlaying then
NFA:Stop()
end
if DFA.IsPlaying then
return
end
DFA:Play()
elseif lighting.ClockTime >= 18 or lighting.ClockTime < 6 then
if DFA.IsPlaying then
DFA:Stop()
end
if NFA.IsPlaying then
return
end
NFA:Play()
end
end)
I recommended you to not write the entire code to them because they could just copy and paste, and then move on without understanding how the code works.