How could I make this door work anywhere?

I have this door system with a lot of moving parts in it and has a very elaborate opening and closing sequence. It only works however when its in a specific position.


Basically what I have it doing is using the tween animations to open. I just took the parts’ current position, and where it is supposed to go in the opening position. Obviously if you put it anywhere else in the world the pieces of the door with just fly off to the set coordinates.
What I’m asking is, is there any simpler way to make this work?

You can just add/subtract/divide/multiply the door’s position/CFrame by a specified Vector3/CFrame so that it will work wherever you put it.

1 Like

it is not recommended to just paste cframe positions so it just works on one spot
also you can use welds lol, you just need to use roblox’s weld constraints (or weld plugins) so you don’t have to tween every part
create a hinge, (if you know door logic you know where the hinge goes), that will be the main part of the door and weld everything from the hinge and tween its orientation

edit: seems like a sliding door lol sorry didn’t read the post MY BRAIN IS OFF

How would you make CFrame equations? Do you just grab the current and do the problem in a line outside of the variable?

For example you can do something like this:

local TweenService = game:GetService("TweenService")

local doorTween = TweenService:Create(script.Parent, TweenInfo.new(0.5, Enum.EasingStyle.Quint), {
	Position = script.Parent.Position + Vector3.new(3, 0, 0)
})

If you send me your door model in a rbxm file, I can do it for you.

Would I just do the same thing for the closing animation except subtract the vector?
image

Found the problem for future reference, do not subtract when you make the return function. Instead use the original position.
image

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.