Invalid argument #1 to 'lookAt' (Vector3 expected, got Instance)

So I’m trying to make something that if you enter a zone it locks your camera into a part but I’m getting an error, how do I fix it?

local Zone_LookAtKetchup = workspace.Zone_LookAtKetchup

local ketchupcframelookat = workspace.KetchupCFrameLookAt

local localplayer = game:GetService("Players").LocalPlayer
local character = localplayer.Character or localplayer.CharacterAdded:Wait()

local TweenService = game:GetService("TweenService")

local currentcamera = workspace.CurrentCamera

local zoneketchup = zoneplus.new(Zone_LookAtKetchup)

local lookAt = currentcamera.CFrame:PointToWorldSpace(Vector3.new(0, 0, -3)):Lerp(ketchupcframelookat.Position, .1)

enteredketchupzone = false

zoneketchup.localPlayerEntered:Connect(function()
	if not enteredketchupzone then
		enteredketchupzone = true
		print("Player Entered ZoneKetchup")
		currentcamera.CFrame = CFrame.lookAt(currentcamera, lookAt)
	end
end)

CFrame.lookAt() requires a Vector3 so you pass the cframe position of the camera

currentcamera.CFrame = CFrame.lookAt(currentcamera.CFrame.Position, lookAt)
2 Likes

Hey, I tried your code and it kinda worked and the character turns backwards, how do I fix this?

What exactly do you mean with “character turns backwards”?
Could you provide me with a screenshot?

I think a video would be better :smiley:

I’m sorry but I can’t help you with that.

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