Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Using the Disaster Kit V2, how can I make maps have different music?

Asked by 5 years ago

So I'm playing around with the Disaster Kit V2 and I made a map rotation system, and I want to make every map have a different background music, but when the map changes, the song keeps playing. How can I make it so specific music only plays on it's specific map?

Here's the script for the map changing if it helps:

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
0
well... the easiest way is to create a part where the players spawn and have a script inside of it and when the players touches it, the music plays. Or you can make a script that whenever a map changes or the game starts, the music starts playing and afterwards, it gets destroyed and so on. 0msh 333 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Here's my concept, why not make a folder where you store your audios?

So if you have audio sound stored in your folder, it should be like this. (make sure sounds are named)

local sound = Instance.new("Sound", game.Workspace)
local bm = --location of the folder
local st = bm.--(sound in folder you want to play)
local en = bm.--(sound you want to stop)

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()
wait(1)
    en.--(audio in the folder currently playing).Sound:Stop()
    sound.Looped = true
    st.--(audio that you want to play next).Sound:Play()
end

If you have any errors or questions about this, feel free to ask, and I might edit this again.

0
I havent used it yet, I'll work on implementing it momentarily but before I do, this should let me assign specific songs for specific maps? Cynical_Potatoe 5 — 5y
0
It should, that's why I insist making a folder filled with sounds (uniquename); ones that you want to keep in your game and not forget. NexoKami 12 — 5y
0
It didn't work unfortunetly, I'll create another question with clearer questions Cynical_Potatoe 5 — 5y
Ad

Answer this question