How to make a day/night music cycle, but that only happens in specific zones/parts of the map?

Title says it. Basically trying to do something like in Raise a Floppa 1, where if you’re in your house, it plays one song when it’s daytime and another one when it’s nighttime, but if you’re in the backrooms, it plays another song.

I’ve been on this for 5 hours, watching several video tutorials, and even tried to use the ZonePlus module since I figured it would be easier but nothing worked. I’m wondering if anyone could give me a brief explanation on what to do? Thanks.

Have background music script in the world
Use a region3 in the house area
Check if player is in the house or not
If he is, mute world music
Check if it is day or night
Play appropriate song

Same for backrooms and anywhere else

Insights about much of the music specific stuff can be found here.
Switching between songs can be as simple as having a currentSong variable that is used in a process like:

  1. currentSong:Stop()
  2. currentSong = next_song
  3. currentSong:Play()

The zones part can be complicated because there are a number of ways you can go about it. Are your zones all separated by chokepoints like doors or hallways, with relatively few ways in and out? Can the zones be defined reasonably well with a sphere, cylinder, or axis-aligned rectangular solid?

If there are places like doors and hallways between the zones where you can place touch-parts that reliably trigger events when a player enters a zone, then the music script can be event-driven. You could use a boolean isDaytime flag and a task.delay(sec_til_day/night, callback) to manage the day/night switch.

If there aren’t convenient chokepoints, then you’d either need to cover the whole zone with a touch-part (possibly using CSG to combine parts–I’ve had mixed success with that kind of thing) or do away with event-driven approach altogether and just use polling. With polling you’d query the player’s position at intervals and check if that point is inside any of your zones (reasonable if not too many zones, and there are ways to help make this a little more efficient).

Any additional info you can supply about the shape of zones, total number of zones, and availability of chokepoints, or about the specific thing you are stuck on right now?