I can no longer rotate with my mouse, help?

So I made a script that is meant to move the player’s camera’s cframe according to the player’s head cframe. Here is my code:

Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = CFrame.new(script.Parent.Head.CFrame.X, script.Parent.Head.CFrame.Y, script.Parent.Head.CFrame.Z)

However now, whenever I try rotating my character, I can’t. How can I fix this?

Is it a local script inside of starter character scripts titled CameraScript?

nope. the game is first person but with this added, it doesn’t allow you to rotate the player with the mouse anymore.

If this is in a loop, the camera will infinitely set the CFrame of the camera to your head position. When you try to move your head it will keep setting back the camera CFrame to that position. Besides, Enum type “Scriptable” doesn’t allow Camera movement to my understanding.

Have you ever set it back to the normal or custom camera type?

Nope. It stays scriptable.
char limitssssssssssssssss

Got it. The point of the script was to keep the camera along with the head, so if the player does a movement, say, crouching, the head moves along with it. How would I do that while keeping the regular player rotation?

Camera.CameraSubject = Head.

https://developer.roblox.com/en-us/api-reference/property/Camera/CameraSubject

  • For all CameraTypes but ‘Scriptable’ , the object whose position the Camera's Camera.Focus will be set to

Why are you setting the camera’s type to ‘Scriptable’ if you want it to follow the player’s character?

Use a combination of CameraSubject and CameraOffset if you want the camera to follow the character’s ‘Head’ limb.

not really follow it, i have a running animation and i want the camera to face anywhere the players head is facing, so like lets say that ur creating slide animation, the head should correspond with the slide animation, if that makes sense.

Camera.CFrame = CFrame.new(Camera.CFrame.Position) * Head.CFrame.Rotation

Basic example, you may need to restrict the rotating to certain axes, ‘X’, ‘Z’ but not ‘Y’ etc.

2 Likes

Didn’t work, I put down this:

local Camera = workspace.CurrentCamera
Camera.CFrame = CFrame.new(Camera.CFrame.Position) * script.Parent.Head.CFrame.Rotation

Would need to be in a loop of some sort, be it an event loop, i.e; RenderStepped or an iteration structure, i.e; while true do or repeat until false.

You may also need to wait for the character’s ‘Head’ part to load/replicate via WaitForChild.

Rotating ur mouse is asking for literal madness, try adding it to a renderstep yourself and see what it will do.

When the camera’s type is set to ‘Scriptable’ the mouse has no impact. The whole purpose of ‘Scriptable’ is to allow developers full control over the camera.

I added a wait, and it should be fine. Thanks.