# Getting looping music to work in Roblox Studio

I've been trying for a few days now to get my background music to work on one of my Roblox places, but every time I get the error:

13:50:23.806 - Players.PungentZeus0.PlayerGui.bgmusic:21: attempt to index global 'Sound' (a nil value)

Here's the code:

local ContentProvider = game:GetService("ContentProvider")

local pageTurnId = "rbxassetid://144585389"

local sound = Instance.new("Sound")
sound.SoundId = pageTurnId

local assets = { sound }

ContentProvider:PreloadAsync(assets)

print("All assets loaded.")

local sound = Instance.new("Sound", game.Workspace)
sound.SoundId = "rbxassetid://144585389"

if not sound.IsLoaded then
sound.Loaded:wait()
end

Sound:Play()


## 1 Answer

It turns out that I simply forgot to put the whole command:

Workspace.Sound:Play()


It now works as expected.