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)
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.