local time = game.Lighting.TimeOfDay
local t = tonumber(string.sub(time,1,2)..string.sub(time,4,5)..string.sub(time,7,8)) --convert time to a number
if t >= 73000 then
for i = .2,0,-.001 do --loop that turns music down over 2 seconds
wait(.01)
script.Sunset.Volume = i
if i == 0 then
script.Sunset:Stop()
break --is this necessary?
end
end
script.Dawn:Play()
elseif t >= 200000 then
for i = .2,0,-.001 do --same for this !
wait(.01)
script.Dawn.Volume = i
if i == 0 then
script.Dawn:Stop()
break
end
end
script.Sunset:Play()
end
I tried this on a multiplayer server, and the song for Dawn wouldn't tone down to 0 volume when the time came along. Any ideas?
ps: Huge thanks to the other guy that suggested I turned the strings into numbers so I could compare them using tonumber.

1 comment
You're welcome! By the way, wait() has a minimum argument: 0.03. Anything below that is the same as wait().