CFrame tweening part to origin?

Whenever I play my tween its orientation changes properly however it returns to the origin of the baseplate. I’m sure its simple but can someone explain why this is happening?

Thanks!

local proxPrompt = script.Parent
local Door = game.Workspace:WaitForChild("Door")
local Hinge = game.Workspace:WaitForChild("Hinge")

local tweenService = game:GetService("TweenService")

local tweenGoalOpen = {}
tweenGoalOpen.CFrame = CFrame.Angles(0,math.rad(90),0)

local tweenGoalClose = {}
tweenGoalClose.CFrame = CFrame.Angles(0,0,0)

local tweenInfo = TweenInfo.new(
	.35,
	Enum.EasingStyle.Bounce,
	Enum.EasingDirection.In,
	0
)

local tweenOpen = tweenService:Create(Hinge, tweenInfo, tweenGoalOpen)
local tweenClose = tweenService:Create(Hinge, tweenInfo, tweenGoalClose)

local doorOpen = false

proxPrompt.Triggered:Connect(function(plr)
	if doorOpen == false then
		tweenOpen:Play()
		doorOpen = true
	else
		tweenClose:Play()
		doorOpen = false
	end
end)

Sorry on phone, but… When you setup your target cframe you are just creating an orientation (angles), which is defaulting to the origin position. You need to make it equal to a cframe with position * your angles cframe. Either do cframe.new(position vector) * cframe,angles(angles) or just use the original cframe and * by the new angle one.

1 Like

Got it, thanks so much for explaining it I really appreciate it

1 Like

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