I'm trying to make double doors and when I click the switch, nothing happens. Please help?
ldoor=script.Parent.Parent.Ldoor rdoor=script.Parent.Parent.Rdoor debounce = true function move() if debouce == true then debounce = false for i=1,14 do ldoor.CFrame=CFrame.new(ldoor.CFrame.x + .5,ldoor.CFrame.y,ldoor.CFrame.z) rdoor.CFrame=CFrame.new(rdoor.CFrame.x - .5,rdoor.CFrame.y,ldoor.CFrame.z) wait() end wait(1.5) for i=1,14 do ldoor.CFrame=CFrame.new(ldoor.CFrame.x - .5,ldoor.CFrame.y,ldoor.CFrame.z) rdoor.CFrame=CFrame.new(rdoor.CFrame.x + .5,rdoor.CFrame.y,rdoor.CFrame.z) wait() end debounce=true end end script.Parent.ClickDetector.MouseClick:connect(move)
I have no idea why it won't work. I set it all up in Studio and ran it like this
ldoor = script.Parent.Parent.Ldoor rdoor = script.Parent.Parent.Rdoor debounce = true function onClicked() if debouce == true then debounce = false i = 1 repeat i = i+1 ldoor.CFrame = CFrame.new(ldoor.CFrame.X +1, ldoor.CFrame.Y , ldoor.CFrame.Z) rdoor.CFrame = CFrame.new(rdoor.CFrame.X -1, rdoor.CFrame.Y, rdoor.CFrame.Z) wait(.01) until i == 14 wait(1.5) i = 1 repeat i = i+1 ldoor.CFrame=CFrame.new(ldoor.CFrame.X -1, ldoor.CFrame.Y, ldoor.CFrame.Z) rdoor.CFrame=CFrame.new(rdoor.CFrame.X +1, rdoor.CFrame.Y, rdoor.CFrame.Z) wait() until i == 14 debounce=true end end script.Parent.ClickDetector.MouseClick:connect (onClicked)
Could not get it to work.