Issues with door swinging open

I’m having issue with a code its mean to swing like a normal door but it moves sideways
Its a Press E to interact door

Code:

local TweenService = game:GetService(“TweenService”)
local Open = {
Position = Vector3.new(1300.45, 14.784, 591.037)
}

local Close = {
Position = Vector3.new(1302.032, 14.784, 594.956)
}

local Tweeninfo = TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
local Open = TweenService:Create(script.Parent.Parent,Tweeninfo,Open)
local Close = TweenService:Create(script.Parent.Parent,Tweeninfo,Close)

script.Parent.Triggered:Connect(function()
script.Parent.Enabled = false
Open:Play()
wait(5)
Close:Play()
script.Parent.Enabled = true
end)

This is in the same script this is just A normal script inside a union

Well since you are using a Position CFrame rather than an Orientation CFrame that explains why it’s just moving to that point.

So instead of the Position parts I will need to put Orientation?

Try using the search tool up top.

You can use hinge attachments, they work a lot smoother than TweenService.

Though an easy fix is as follows:
Change the Orietation or the CFrame instead of the door, I suggest to first make a part which is on the end of the door then weld the rest of the door to this part, after this you weld the part and do something like this:

local Open = {["CFrame"] = HingePart.CFrame}
local Close = {["CFrame"] = HingePart.CFrame * CFrame.Angles(0,0,math.rad(90))} -- Move math.rad around or change the value to negative until it works.
1 Like