Attempt to call a nil value when using lookVector()

Hi there, I have this simple script which edits the cframe of the right shoulder based of mouse.Hit.Position. The issue is, is that it returns a error saying attempt to call nil value. I do not know the issue as it seems perfectly fine to me, nor do I have a attempt.

local plr = game.Players.LocalPlayer
local rightarm = plr.Character.Torso["Right Shoulder"]
local mouse = plr:GetMouse()
mouse.Move:Connect(function()
	rightarm.C0 = CFrame.lookVector(rightarm.C0,mouse.Hit.Position)
end)

It’s CFrame.new(rightarm.C0,mouse.Hit.CFrame).lookVector

Vector3 expected, got CFrame, should I change it to vector3.new?

Yeah, that would work. I corrected my reply so I hope that works.

lookVector is not a valid member of Vector3

Try converting the CFrame value with .lookVector into a Vector3. Look at my 1st reply to see the code

Now it’s saying vector3 expected, got cframe? Should I make it mouse.Hit, not mouse.Hit.Position?

Try using Mouse.Hit.CFrame instead.

I don’t think that’s a thing, since mouse.Hit is CFrame, but I tried that before too and both didn’t work.

It’s saying CFrame is not a valid member of CFrame

CFrame.new(rightarm.C0.p,mouse.Hit.p).lookVector

CFrame is not a valid member of CFrame

I fixed it by doing this CFrame.lookAt(rightarm.C0.p,mouse.Hit.Position)

1 Like