I have two scripts, one is used for playing music, one is used for changing the map in the game, what I would like to know is how to make it so music will only play on the map that it's made to play on? I'm putting the music script in the map models them selves, when the map is pulled up it'll start the music, however when the map changes, them usic from the one that was just up stays. Any help is appreciated
Music Script:
ID = '307904550'-- put the id of the song here
Looped = false -- Set to false if you want non-looped music.
Music=Instance.new("Sound" ,Workspace)
Music.Name = "Music"
if Looped == true then
Music.Looped = true
end
Music.SoundId = "http://roblox.com/asset/?id="..ID..""
Music:Play()
Map Change Script:
function regenStructures()
workspace.Structures:ClearAllChildren()
local maps = game.ServerStorage.Clones.Maps:GetChildren()
local mapCopy = maps[math.random(1, #maps)]:Clone()
mapCopy.Parent = workspace.Structures
mapCopy:MakeJoints()
end

4 comments
It didn't work, it broke the whole game actually
Lol sorry
Try adding The music script from line 6 then
It starts a whole new function, it would disrupt the flow of the script and break it. Thanks for the suggestions anyway