lookAt is not valid member of CFrame help

So what I am trying to do is to point players right arm to mouse position. But For some reason, I get this error:
image
I am pretty sure that lookAt is a valid member of CFrame, which is weird. I tried searching for this issue on google, but got literally no results. Any help will be appriciated.
My script:

repeat wait(0.5) until game:IsLoaded()
local player = game.Players.LocalPlayer
local char = player.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local RightShoulder = char:WaitForChild("RightUpperArm")
local wpEquipped = false

script.Parent.Equipped:Connect(function()
	wpEquipped = true
end)

script.Parent.Unequipped:Connect(function()
	wpEquipped = false
end)

local function lookDirection()
	if wpEquipped == true then
		RightShoulder.CFrame.lookAt(player:GetMouse().Hit)
	end
end

game["Run Service"].RenderStepped:Connect(lookDirection)

You’re calling the lookAt function from a ‘CFrame’ value, not from the ‘CFrame’ class.

CFrame.lookAt(Vector1, Vector2) --Correct syntax.

1 Like

Is this how you meant it?

RightShoulder.CFrame.lookAt(RightShoulder.Position,player:GetMouse().Hit)

Because if you did, it still gives me the same error

No, I meant exactly what I stated in my post.
You can find examples of CFrame.lookAt's use here.

RightShoulder.CFrame = CFrame.lookAt(Position1, Position2) --'Position1' and 'Position2' must be 'Vector3' values.
1 Like

No, use the CFrame global. You’re accessing the CFrame properties

You can use this:

RightShoulder.CFrame = CFrame.lookAt(RightShoulder.Position, player:GetMouse().Hit)