Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Can I somehow combine these to make it so music stays specific with it's map?

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

1 answer

Just create a sound and put it in the model/map, set its properties Then at the line 6 of map change script, put

mapCopy.Music:Play() -- Assuming that u put the song inside of the map and u named it Music

4 comments

0

It didn't work, it broke the whole game actually

0

Lol sorry

0

Try adding The music script from line 6 then

0

It starts a whole new function, it would disrupt the flow of the script and break it. Thanks for the suggestions anyway

This discussion is preserved as it was. New answers, comments, and votes are closed.