This script should play a short simple sound when the door is clicked and play another sound when it closes 5 seconds later, it doesnt work
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()
end
if (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
end
if (set == false) then
v.Transparency = 0
v.CanCollide = true
set = true
end
end)
end
end
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()
end
if (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
end
if (set == false) then
v.Transparency = 0
v.CanCollide = true
set = true
end
end)
end
end
if (set == true) then
v.Transparency = 1
v.CanCollide = false
Open:play()
wait(5)
set = false
v.Transparency = 0
v.CanCollide = true
Close:play()
end
if (set == false) then
v.Transparency = 0
v.CanCollide = true
set = true
end
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
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
Are you trying to achieve where you open the door and the open sound plays and after 5 seconds, the door closes with the close sound?
Your problem must be that the same sound plays on opening and closing, right? Please tell which sound is playing on both opening and closing of the door.