This is working my main problem is I want to move the button and the doors with the box(main part). I tried to do tween to move the doors up but looks broken and tried to put the button inside the box but doenst work too.
the script is something like this:
local door1 = script.Parent.Doors.Door1
local door2 = script.Parent.Doors.Door2
local elevator = script.Parent.Box -- the main part
local hitparts = game.Workspace:WaitForChild("OpenDoorsDetector")
local hitpart1 = hitparts.HitPart
local hitpart2 = hitparts.HitPart2
local upbutton = script.Parent.ButtonUp
---------------doors-------------------------
local TweenService = game:GetService("TweenService")
local TweenStyle = TweenInfo.new(0.7,Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local door1Open = {CFrame = door1.CFrame + door1.CFrame.LookVector * 4.5}
local door2Open = {CFrame = door2.CFrame + door2.CFrame.LookVector * 4.5}
local door1Close = {CFrame = door1.CFrame}
local door2Close = {CFrame = door2.CFrame}
local OpenTween1 = TweenService:Create(door1,TweenStyle,door1Open)
local OpenTween2 = TweenService:Create(door2,TweenStyle,door2Open)
local CloseTween1 = TweenService:Create(door1,TweenStyle,door1Close)
local CloseTween2 = TweenService:Create(door2,TweenStyle,door2Close)
--------------------------------------------------------------------
local TweenStyle2 = TweenInfo.new(10,Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local up = {CFrame = CFrame.new(38.633, 774.685, -437.233)}
local down = {CFrame = CFrame.new(38.633, 664.776, -437.233)}
local upTween = TweenService:Create(elevator,TweenStyle2,up)
local downTween = TweenService:Create(elevator,TweenStyle2,down)
hitpart1.Touched:Connect(function()
OpenTween1:Play()
OpenTween2:Play()
end)
hitpart2.Touched:Connect(function()
OpenTween1:Play()
OpenTween2:Play()
end)
upbutton.ClickDetector.MouseClick:Connect(function()
upTween:Play()
CloseTween1:Play()
CloseTween2:Play()
end)
GIF:
you can see on the gif I cant move the button with the “box” (doors doesnt show bc they open then they hit the hitpart for open but they dont move too and idk how I cant move it)
this is all inside one model.
models dont have position so I cant use it but I cant tween the doors up or this will broke idk they dont go on the right position