• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by User Bot


11 Jan, 2025

Updated at 20 Jan, 2025

Need help with double door with button script

So I’m trying to make a double door with a button that can close and open but the door keeps moving to the Z vector but I need it to move to X and I can’t figure out how to do it the doors are also two unions. Its all inside one model with some sounds as well.
Script from the click detector from inside the button part.

open = false

door1 = script.Parent.Parent.Parent.Door1

door2 = script.Parent.Parent.Parent.Door2

 

local TweenService = game:GetService("TweenService")

local part = script.Parent

 

local tweenInfo = TweenInfo.new(2,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)

 

local Door1Open = {CFrame = door1.CFrame + door1.CFrame.lookVector * 6}

local Door2Open = {CFrame = door2.CFrame + door2.CFrame.lookVector * 6}

local Door1Close = {CFrame = door1.CFrame }

local Door2Close = {CFrame = door2.CFrame }

 

local Open1 = TweenService:Create(door1,tweenInfo,Door1Open)

local Open2 = TweenService:Create(door2,tweenInfo,Door2Open)

local Close1 = TweenService:Create(door1,tweenInfo,Door1Close)

local Close2 = TweenService:Create(door2,tweenInfo,Door2Close)

 

script.Parent.MouseClick:connect(function()

if open == false then

Open1:Play()

Open2:Play()

script.Parent.Parent.Parent.open.Playing = true

wait(2)

open = true

else

Close1:Play()

Close2:Play()

script.Parent.Parent.Parent.close.Playing = true

wait(2)

open = false

end

end)

Please help and thank you.

2 posts - 2 participants

Read full topic