As the title says, I need help with making a way that that multiples a CFrame value that can vary till it reaches a value I specify in the script below.
local DOOR_TWEEN_SERVICE = {}
function DOOR_TWEEN_SERVICE:TWEEN_DOOR(Door)
local TweenService = game:GetService("TweenService")
local TweenInfo = TweenInfo.new(1.25, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out)
local GOALS = {
FIRST_GOAL = {CFrame = CFrame.new(Door.Position) * CFrame.Angles(0, math.rad(-90), 0)},
SECOND_GOAL = {CFrame = CFrame.new(Door.Position) * CFrame.Angles(0, math.rad(-180), 0)}
}
local OPEN_STATUS = TweenService:Create(Door, TweenInfo, GOALS.FIRST_GOAL)
local CLOSED_STATUS = TweenService:Create(Door, TweenInfo, GOALS.SECOND_GOAL)
return {OPEN_STATUS;CLOSED_STATUS}
end
return DOOR_TWEEN_SERVICE
Now this is good only if the Door’s hinge is at a 0 Degree orientation, say if it were at something like 45, it won’t work cleanly, like in the gif below
https://gyazo.com/ede118109c45becb2832ba251fcb2cfc
How would I go about making it so that in the module, it multiplies it’s hinge CFrame till it reaches 90 Degrees so it’ll work even at different orientations the hinge is at?