Ideally, I would like the music to start playing when you touch a certain block. Precisely so that when you touch once and another song starts playing
2 Likes
You would have a part.Touched connection function on that part and then play the sound respective to that part. A lot of resources are available for this kinda thing.
1 Like
I found a script, but I need the music to play when I step on a block and then when I step on another block the music from the previous block stops (I hope I explained it clearly)
1 Like
Well I won’t provide you with complete code but I will provide you with a decent structure for something like this
local currentMusic = ""
local Parts = { ["Music_1"] = { state = nil } }
workspace[Parts["Music_1"]].Touched:Connect(function()
-- get the music for the block
-- play music for the block
-- set currentMusic
-- set block state to playing
end)
-- other parts
-- check if other parts are playing if so, stop the music.
-- set currentMusic to this parts respective song and play and set state.
-- etc, etc
Definitely not the best/efficient way to do things but it’s a rough idea.