So i have a game where i would like to be able to change the music depending where they are in the map.
I have attempted to have big walls indicating the zones that they can be in and when they touch a wall, it will delete other sounds playing for them?
Is there a better way to do this, because this doesn't feel too efficient.
Thank you.
I would look into Region3's, but I don't think they would be more efficient than what you're doing because you can't actually see a Region3, and they would take much longer to create compared to a part.
What I would suggest doing though is putting all your walls into ReplicatedFirst. The server cant access ReplicatedFirst, so less load on the server.
Then you can clone all the walls in ReplicatedFirst from a local script and put them in workspace, so the server doesn't have to handle the touch events.
Assuming your game is FilteringEnabled
LAZIEST WAY:
Make a giant invisible part which is no collide that encompasses a certain zone.
then do this:
Ex.
game.Workspace.MusicZone1part.Touched:connect(function(hit) if hit.Parent:FindFirstChild('Humanoid') then (play music) end end)
Ex.
game.Workspace.MusicZone1part.TouchedEnded:connect(function(hit) if hit.Parent:FindFirstChild('Humanoid') then (stop music) end end)
also u may wanna use an if statement if certain zones have the same audio or something else to say something like (if this audio is already playing, don't try to restart it)
I MADE U A partially WORKING EXAMPLE:
https://www.roblox.com/library/1878437547/saodsijadoij