Tween camera look at a part

So, I want to make player’s camera look at a part (in first person, the camera connect to neck) with tweenservice.
Here is my code:

Script

local TweenService = game:GetService(“TweenService”)

script.Parent.ProximityPrompt.Triggered:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild(“HumanoidRootPart”)
local camera = workspace.CurrentCamera
local part = script.Parent.Parent.ExitPosition
local targetObj = script.Parent.Parent.look

local tweeninfo = TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)

local tween = TweenService:Create(hrp, tweeninfo, {Position = part.Position})
local rotate = TweenService:Create(hrp, tweeninfo, {Orientation = Vector3.new(0, 0, 0)})
local cameraTween = TweenService:Create(hrp, tweeninfo, {CFrame = CFrame.new(hrp.Position, targetObj.Position)})

if script.Parent.ProximityPrompt.ActionText == "Hide" then
	tween:Play()
	rotate:Play()
	cameraTween:Play()
end

end)

I made my own script but it didn’t work, please help me.

im not great at tweening, but what if you were to set the players camera to scriptable and then set the cameras cframe to a part, and then tween the part? idk if thats possible.

1 Like

I think you should tween the camera’s CFrame to either:

The offset between the camera’s CFrame and the part’s CFrame
The part’s CFrame

1 Like

i’ll try to change the cameratype, I didn’t try it

good idea, I’ll change some to make it works