Basically I want this door to be able to move properly even with different positions and rotations. For some reason it constantly moves in some random ways I never can fix. Here are some images to help anyone willing to help me out figure this out. Thank you for reading all of this and hopefully I can figure it out and maybe learn something in the end.
local Knob = script.Parent.Knob local Frame = script.Parent.Frame local Screen = script.Parent.Screen local deg = Frame.Orientation.Y local Open = script.Parent.Open function OpenDoor() Frame.CFrame = CFrame.new(Frame.Position.X + 2.25,Frame.Position.Y,Frame.Position.Z + 2.25) Frame.Orientation = Vector3.new(0, deg - 90 , 0) Knob.CFrame = CFrame.new(Knob.Position.X - 4,Knob.Position.Y,Knob.Position.Z - 4) Knob.Orientation = Vector3.new(0, deg + 90 , 0) Screen.CFrame = CFrame.new(Screen.Position.X - 2.1,Screen.Position.Y,Screen.Position.Z - 2.1) Screen.Orientation = Vector3.new(0, deg + 90 , 0) script.Parent.OpenFX:Play() end function CloseDoor() Frame.CFrame = CFrame.new(Frame.Position.X - 2.25,Frame.Position.Y,Frame.Position.Z - 2.25) Frame.Orientation = Vector3.new(0, deg - 90 , 0) Knob.CFrame = CFrame.new(Knob.Position.X - 4,Knob.Position.Y,Knob.Position.Z - 4) Knob.Orientation = Vector3.new(0, deg - 90 , 0) Screen.CFrame = CFrame.new(Screen.Position.X - 2.1,Screen.Position.Y,Screen.Position.Z - 2.1) Screen.Orientation = Vector3.new(0, deg - 90 , 0) script.Parent.OpenFX:Play() end Open.Changed:Connect(function() print("adasadsdasdas") if Open.Value == true then print("close") CloseDoor() else print("open") OpenDoor() end end) function KnobClicked() if Open.Value == false then if script.Parent.Broken.Value == false and Open.Value == false then print("open") Open.Value = true end elseif script.Parent.Broken.Value == false then print("close") Open.Value = false end end Knob.ClickDetector.MouseClick:Connect(KnobClicked)
If you have any questions I perfer using Discord, but I also can tr and check up on here although Im not too active anymore.
My best recommendation is to follow this video. It describes everything you need to make your door work!
If you have any questions or issues please contact me. ;)