I set the sound to play when the door is opening but the sound is playing when closing
local cs = game:GetService("CollectionService")
local doors = cs:GetTagged("DoorTag")
local ts = game:GetService("TweenService")
local db = true
for _,door in pairs(doors) do
local doorSound = door:WaitForChild("BuzzSound")
local openPart = door.Parent.CellRoom:WaitForChild("OpenPart")
local info = TweenInfo.new(3, Enum.EasingStyle.Exponential,Enum.EasingDirection.Out,0,false,0)
local open = ts:Create(door, info, {CFrame = door.CFrame + Vector3.new(0,0,4.72)})
local close = ts:Create(door, info, {CFrame = door.CFrame})
openPart.Touched:Connect(function(hit)
if db and hit.Parent:FindFirstChild("Humanoid") then
db = false
open:Play() open.Completed:Wait()
doorSound.Playing = true
close:Play() close.Completed:Wait()
db = true
end
end)
end