Assuming this is music that should be playing for one person only, put the value in ReplicatedStorage and connect it to a localscript.
As for your code, you’ll probably need to assign it to an event. (.Changed works)
How would I connect it to a localscript? And how would .changed work? I need specific tracks to play for specific stage numbers instead of just general when it changes
Use the .Changed (or GetPropertyChangedSignal) event on your value.
What it does is pick up on any changes made to the value, allowing you to run some code if it does.
Alternatively, you can listen for a .Touched event.
I suppose I could have some sort of stage handler script somewhere that has a long line of "(level number gate).touched and then play the appropriate music, it’d be super long and untidy but I guess it’d work
You must be using a server script to teleport a player to the next stage/level. So in order to change the music, you can use a RemoteEvent and fire it when the player gets teleported. And then insert a local script maybe into startergui, define the sound and try changing it from there.
Edit: I forgot to mention, FYI use FireClient(player)
Is there something specific (aside from security of course) that warrants putting the localscript into StarterGui?
It might be better to have 1 localscript.
I am pretty sure they don’t work if parented to a part/model in workspace or workspace itself and thats why I asked him to parent the local script to StarterGui, If I missed something lemme know.