I’m trying to point the player’s camera towards a part in workspace, like a tween, so it slowly moves there.
My code is below.
local Head = Vector3.new(script.Parent:FindFirstChild("Head").Position)
local AHead = Vector3.new(game.Workspace:FindFirstChild("Model").Head.Position)
local LookAt = CFrame.new(Head,AHead)
print(LookAt)
game:GetService("TweenService"):Create(game.Workspace.Camera,TweenInfo.new(2),{CFrame = LookAt}):Play()
task.wait(2)
end)
The Head Variable is our character’s head.
The AHead Variable is the character’s head i’m trying to look at.
The tween works fine, however the positioning i’m doing isn’t working. And beyond that I don’t know where to go.
I’ve searched forever on devforum on solutions, couldn’t find one, please help.
That is almost the solution. I’m a bit new to scripting so I don’t know everything, Also how will I get the currentcamera’s position? not the CFrame of it.
You need to make the camera type scriptable if you want to modify any properties of it, including the cframe. To revert back to normal, simply set it to custom. Note that setting it to custom will jump the camera which may not be ideal so it might be a good idea to record the current camera cframe before tweening and tween back in a sense when done.