Music not playing when I play/playhere the game in roblox studio?

Hello,

I’ve made a little script to play some music, and the script is working perfectly fine when I join the game from roblox, when I press the run button in studio, and when I test it with server and clients, but it isn’t working when I press play/play here in studio. I can’t figure out what’s wrong.

Here is the script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local musicFolder = ReplicatedStorage:WaitForChild("BackgroundMusic")
local availableMusic = musicFolder:GetChildren()

while true do 
	for i, sound in pairs(availableMusic) do
		if sound.IsLoaded then 
			sound:Play()
			sound.Ended:Wait()
		else 
			sound.Loaded:Wait()
			sound:Play()
			sound.Ended:Wait()
		end
	end
end
1 Like

Simply go to Home > Game Settings > Security > Enable Studio Access to API Service (Make sure to publish the game if you don’t see this menu), after enabling the settings there should be music playing in your game.

1 Like

I’m not sure, maybe it’s a bug or something. But I tested the code and it worked for me even in studio.

Yeah, maybe it’s a bug. It’s not working in studio, at all.