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.