I need help, my sound will not play

local doll = game.Workspace.dolls.doll1.ClickDetector
local haha = game.Workspace.dolls.doll1
local doll2 = game.Workspace.dolls.CHAIR1doll
local sound = doll.Parent.Sound
local one = game.Lighting.one
local two = game.Lighting.two
local number = game.Workspace.numberSeven.seven
local Part = script.Parent

one.Enabled = false	
two.Enabled = false
number.Transparency = 1



doll.MouseClick:Connect(function()
		sound:Play()
	doll:Destroy()
	haha:Destroy()
	for i = 0, 20, 1 do -- Will repeat 20 times
			one.Enabled = true
			task.wait(.03)
			one.Enabled = false
			task.wait(.03)
			two.Enabled = true
			task.wait(.03)
			two.Enabled = false
			task.wait(.03)
		end

		local function RemoveObject()
			local DestroyCheck = workspace.dolls:FindFirstChild("doll1")

		local part = script.Parent   --part, our our doll

		local playersService = game:GetService('Players')    -- emmber players isa service and we have to get that
		local player = playersService:FindFirstChildOfClass('Player')    --Were finding the player
		local leaderstats = player:FindFirstChild("leaderstats")   --the leaderstats we made 
		local dolls = leaderstats:FindFirstChild('Dolls') --Our dolls number
		dolls.Value = dolls.Value + 1 --Adds 1 to our doll count
		for i,v in pairs(workspace.dolls.doll1:GetDescendants()) do
			if v:IsA("BasePart") or v:IsA("Decal") then	
				v.Transparency = 1
				if v.Transparency == 1 then
					doll:Destroy()
				end
				for i,v in pairs(workspace.dolls.CHAIR1doll:GetDescendants()) do
					if v:IsA("BasePart") or v:IsA("Decal") then
						v.Transparency = 0
						number.Transparency = 0
					end
				end
			end
		end
	end
end)

my sound will not play, and it played before i added the ‘haha:Destroy’, please help

check to see if the sound volume is at 0

This happens because you’re deleting the doll object to which the sound is parented to, so naturally the playback will be discontinued. You need to put that sound somewhere else and play it instead, whether you shuffle it around in the hierarchy so it’s also not destroyed or if you play it a different way (e.g. spawning a temporary emitter at the position of where the sound should play, making the model invisible until the sound finishes and then deleting it, so on).

its not, the background music is playing

You’re destroying the doll object which the sound is parented inside of. ‘haha’ is that exact object that has the sound inside of it.

i made a part ontop of it with the sound, and it still doesnt work. the part has cancollide + cantouch off and massless on

Where is the part? It cannot be in the path workspace.dolls.doll1, otherwise the part will still get deleted and thus the sound playback will still not occur.

My absolute “lazy” way to get around this issue is just to create a temporary sound emitter in the Terrain using an attachment. It feels like you should just divorce the sound from the model since you intend to destroy it, so naturally the sound wouldn’t play.

local function playSoundAtPosition(sound, pivotCFrame)
    local emitter = Instance.new("Attachment")
    emitter.Name = "SoundEmitterAttachment"
    emitter.CFrame = pivotCFrame

    local newSound = sound:Clone()
    newSound.Ended:Connect(function ()
        task.defer(emitter.Destroy, emitter)
    end)

    newSound.Parent = emitter
    emitter.Parent = workspace.Terrain

    newSound:Play()
end

You can throw this above your MouseClick connection then call this function instead of directly playing the sound. Use GetPivot to get the pivot CFrame of your emitter.

playSoundAtPosition(sound, doll:GetPivot())