To get the camera angles in a localscript, I have this code:
function cameraAngles() local x,y,z = workspace.CurrentCamera.CFrame:toEulerAnglesXYZ() return Vector3.new(x,y,z) end
Then, I use the y of those angles to rotate the RotVelocity of a sphere:
script.Parent.RotVelocity = CFrame.fromEulerAnglesXYZ(0, cameraAngles.y, 0) * controls.Unit * 100
The controls records the input of the WASD Keys, and converts them into a vector3. Back in the localscript:
function getWasdKeys() local outputMovementVector = Vector3.new(0,0,0) for _,key in ipairs(UserInputService:GetKeysPressed()) do if key.KeyCode == Enum.KeyCode.W then outputMovementVector = Vector3.new(outputMovementVector.X + 1, 0, outputMovementVector.Z) end if key.KeyCode == Enum.KeyCode.S then outputMovementVector = Vector3.new(outputMovementVector.X - 1, 0, outputMovementVector.Z) end if key.KeyCode == Enum.KeyCode.A then outputMovementVector = Vector3.new(outputMovementVector.X, 0, outputMovementVector.Z - 1) end if key.KeyCode == Enum.KeyCode.D then outputMovementVector = Vector3.new(outputMovementVector.X, 0, outputMovementVector.Z + 1) end end return outputMovementVector end
I think the problem is that the y camera angle reaches 0 at two opposite points.