#Delayed sound

1 messages · Page 1 of 1 (latest)

tribal zephyr
#

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
proud sierra
#

you might want to move doorSound.Playing before open:Play()?

tribal zephyr
#

it worked btw