Hello developers, I’ve got a very simple line of code for some reason its returning the error “Argument 3 missing or nil”
I am sure its something dumb that i am missing here can somebody help me with this?
Hello developers, I’ve got a very simple line of code for some reason its returning the error “Argument 3 missing or nil”
What are you trying to do?
make the head the same rotation as the camera
You should probably use this. Rotating a characters head to match Camera rotation - #6 by Partixel
I don’t think this will work I am using a vr camera attached to the players head and I need the rotation of the head to match the camera
Can you send the full line of code?
Try this
Head.CFrame = CFrame.new(Head.Position, workspace.CurrentCamera.CFrame.Position)*CFrame.Angles(0, math.rad(180), 0)
WADSCOOOLL being my character
Maybe try accessing the rotation of the head instead of the CFrame,
head.Rotation = camera.CFrame.Rotation
could the line above be causing a problem?
I’m pretty sure CFrame.Angles()
requires 3 arguments, X Y and Z. Are you trying to make head camera rotation?
Yes I am trying to make the head the same rotation as the camera
char.Head.CFrame = CFrame.new(char.Head.Position, camera.CFrame.Position)*CFrame.Angles(0, math.rad(180), 0)
Use CFrame.Orientation and not CFrame.Position,
using position means you’re moving the part on the X,Y,Z axis, and orientation is used for rotating parts.
maybe, dunno if this will help it
Cameras don’t have an Orientation or at they didn’t when i tried it
CFrame.new takes two arguments, one for position and for orientation.
In this case you’re gonna have to rotate the neck Motor6D of the character. You’ll also have to fire an event to the server so it’ll update for other players. There are plenty of tutorials that dig deeper into it so I recommend you should watch one.
In short, you find the neck Motor6D of the character that is located in the torso and change the C0 to the CFrame you want. Then you fire an event to the server, and the server sends a signal to other players to update the neck Motor6D on their side. It’s pretty late and I’m kinda tired so sorry if this is not much.
okeanskiy made a neat tutorial about it:
Rotate Head to Camera Direction! - Roblox (Motor6D CFrame and Trigonometry) - YouTube
Oh, without the CFrame involved.
only assign the Rotation
property
head.Rotation = camera.CFrame.Rotation
-- this exact code
this would error since CFrame.Rotation
is a cframe.