Sound played at both opening and closing of door

im trying that yes, and no, theres no sound playing at all, and with the new script adjustments made in this thread the door doesnt open anymore either.

image
for closing: rbxassetid://8449082850
for open: rbxassetid://8085606989

Are you sure open and closed arent the animations?

I dont see anything for sound in this script.

image

I believe those originally referred to the animationsā€¦ and when you changed their capitalization you broke the animations.

im unfamiliar with how sounds work, thats why i made this thread to help

Change the capitalizations backā€¦if door works thats the animationā€¦ then u will need to add in the sounds after but try that first.

P is now uncapitalized but still nothing works

local model = script.Parent.Parent
local clickdetector = script.Parent
local open = workspace.Doorsclosed.Open
local close = workspace.Doorsclosed.Close

local set = true

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

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

for _,v in pairs(model:GetChildren()) do
	if v:IsA("Part") then
		clickdetector.MouseClick:Connect(function()
			if set == true then
				v.Transparency = 1
				v.CanCollide = false
				open:play()
				wait(5)
				set = false
				v.Transparency = 0
				v.CanCollide = true
				close:play()
			
			elseif set == false then
				v.Transparency = 0
				v.CanCollide = true

				set = true
			end
		end)
	end

	if v:IsA("WedgePart") then
		clickdetector.MouseClick:Connect(function()
			if set == true then
				v.Transparency = 1
				v.CanCollide = false
				wait(5)
				set = false
				v.Transparency = 0
				v.CanCollide = true
			
			elseif set == false then
				v.Transparency = 0
				v.CanCollide = true

				set = true
			end
		end)
	end
end

Maybe itā€™s because the sounds are in a model? Try putting it in a part.

still no luck.

local model = script.Parent.Parent
local clickdetector = script.Parent
local open = workspace.Doorsclosed.Test.Open
local close = workspace.Doorsclosed.Test.Close

local set = true

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

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

for _,v in pairs(model:GetChildren()) do
	if v:IsA("Part") then
		clickdetector.MouseClick:Connect(function()
			if set == true then
				v.Transparency = 1
				v.CanCollide = false
				open:play()
				wait(5)
				set = false
				v.Transparency = 0
				v.CanCollide = true
				close:play()
			
			elseif set == false then
				v.Transparency = 0
				v.CanCollide = true

				set = true
			end
		end)
	end

	if v:IsA("WedgePart") then
		clickdetector.MouseClick:Connect(function()
			if set == true then
				v.Transparency = 1
				v.CanCollide = false
				wait(5)
				set = false
				v.Transparency = 0
				v.CanCollide = true
			
			elseif set == false then
				v.Transparency = 0
				v.CanCollide = true

				set = true
			end
		end)
	end
end

Did you checked that the sounds have volume above 0 and a normal pitch?

yes, they have normal volume and pitch

I see something.

The Doorsclosed model is inside of another model, and youā€™re trying to get sounds using workspace.Doorsclosed.

If thatā€™s the Issue, then try to get into a model where the Doorsclosed is.

1 Like

i forgot i made a new group earlier, it works now ty!

local model = script.Parent.Parent
local clickdetector = script.Parent
local open = workspace.Doors.Doorsclosed.Test.Open
local close = workspace.Doors.Doorsclosed.Test.Close

local set = true

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

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

for _,v in pairs(model:GetChildren()) do
	if v:IsA("Part") then
		clickdetector.MouseClick:Connect(function()
			if set == true then
				v.Transparency = 1
				v.CanCollide = false
				open:play()
				wait(5)
				set = false
				v.Transparency = 0
				v.CanCollide = true
				close:play()
			
			elseif set == false then
				v.Transparency = 0
				v.CanCollide = true

				set = true
			end
		end)
	end

	if v:IsA("WedgePart") then
		clickdetector.MouseClick:Connect(function()
			if set == true then
				v.Transparency = 1
				v.CanCollide = false
				wait(5)
				set = false
				v.Transparency = 0
				v.CanCollide = true
			
			elseif set == false then
				v.Transparency = 0
				v.CanCollide = true

				set = true
			end
		end)
	end
end

So that others checking this thread dont find it useless, here is a link that explains why your script is breaking when the sound doesnt load in:

https://developer.roblox.com/en-us/api-reference/property/Sound/IsLoaded