I have 3 doors and soon will have more but how do I open all doors with 1 script WITH A DEBOUNCE that WONT stop other doors from opening other than the one that has been pressed. Now I have made this script which DOES indeed work and opens all doors in the game from 1 script however you can multiple-click doors which I do not want to happen so how do I do it? Code is here:
--variables--
local debounce = false
local Doors = game.Workspace.Doors:GetChildren()
for i, v in pairs(Doors)do
function open()
local Door1 = v.Door1
local Door2 = v.Door2
local Sound = v.Frame.OpenSound
Sound:Play()
Sound.Pitch = 1
for i = 1, 30 do
Door1.CFrame = Door1.CFrame - Vector3.new(.1,0,0)
Door2.CFrame = Door2.CFrame + Vector3.new(.1,0,0)
wait(.01)
end
wait(.5)
Sound:Play()
Sound.Pitch = .7
for i = 1, 30 do
Door1.CFrame = Door1.CFrame + Vector3.new(.1,0,0)
Door2.CFrame = Door2.CFrame - Vector3.new(.1,0,0)
wait(.01)
end
end
v.Panel1.Button.ClickDetector.MouseClick:connect(open)
v.Panel2.Button.ClickDetector.MouseClick:connect(open)
end
