Here is script
-- Arrays of asset IDs for lobby and round music
local lobby_id = {"rbxassetid://1844683265"}
local round_id = {"rbxassetid://1842725760"}
-- Music sound objects in the workspace
local lobby_music = workspace.Music["Lobby music"]
local round_music = workspace.Music["Round music"]
-- IsGame BoolValue to determine the current game state
local IsGame = game.ReplicatedStorage:WaitForChild("IsGame")
-- Function to handle music changes based on game state
IsGame:GetPropertyChangedSignal("Value"):Connect(function()
if IsGame.Value then
-- When the game starts, stop lobby music and play round music
lobby_music:Stop()
local chosen_round_music = round_id[math.random(1, #round_id)]
round_music.SoundId = chosen_round_music
round_music:Play()
else
-- When the game ends, stop round music and play lobby music
round_music:Stop()
local chosen_lobby_music = lobby_id[math.random(1, #lobby_id)]
lobby_music.SoundId = chosen_lobby_music
lobby_music:Play()
end
end)
-- Start with lobby music by default
local chosen_lobby_music = lobby_id[math.random(1, #lobby_id)]
lobby_music.SoundId = chosen_lobby_music
lobby_music:Play()
What should I add?