Why won't it let me move my camera?

Im making a realistic camera system where i used this code to snap the camera’s position to the heads position:

--Camera-to-Head attaching
humanoid.CameraOffset = Vector3.new(0, 0, -1.5)
camera.CFrame = CFrame.new(head.Position)

This is inside a RunService.RenderStepped function and my goal is to make the camera always be the heads position but be able to move around like a normal camera.

1 Like

Did you set the camera type if not that would be your issue.

All variables are defined and no other script does anything to the camera

I did not i will try that and quick response :flushed:

I set the camera type by doing this before changing the CoordinateFrame: camera.CameraType = Enum.CameraType.Scriptable and it still doesnt change anything, no errors in output aswell

How are you defining the camera object?

local Camera = workspace.CurrentCamera

local camera = workspace.Camera
local rs = game:GetService("RunService")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local head = character:WaitForChild("Head")

rs.RenderStepped:Connect(function()
	camera.CFrame = head.CFrame
end)

This is working on my end in a local script.

1 Like

So reading your problem carefully: Your camera is going to the head, but preventing you from looking around. You want to put the camera where the head is but still have the player look around, “realistic” as you say.

This sounds like a “first person camera system” to me, and we can do this with a simple property.

Select StarterPlayer
image
Open properties menu and change CameraMode to “LockFirstPerson”
image

Boom we have a camera snapped to the position of the head where we can still look around, a “realistic” camera as you call it!

Alternatively if you want to use a script, you can do it with one line of code as so:

game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson

and get rid of the whole RenderStepped connection.

I dont want to do that because you are setting the cameras cframe to the heads cframe meaning if the head turns the camera turns with it, plus i just tested it

Now my camera is just flinging all over the place!

Remove the function on RenderStepped.

Oh nvm its because i havent changed back my code, i put it back to the initial code and still didnt make difference

ITs not flinging over the place though lol

Delete all your code for your camera that you have because this is literally all you need to make a first person camera

game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
local camera = workspace.Camera
local rs = game:GetService("RunService")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local head = character:WaitForChild("Head")

rs.RenderStepped:Connect(function()
	camera.CFrame = CFrame.new(head.CFrame.X, head.CFrame.Y, head.CFrame.Z+15)
end)

It’s not too difficult to add an offset, this will follow the character from behind.

Ik but i want a camera offset, and when i do that if i turn fast enough i can see my body in FIRST PERSON so im making the the camera snap to the heads position

This isnt what i want, im making a first person camera

Ohh okay I see, give me a minute to create a new reply because this takes a bit more work

Then why did you add an offset in the original script? You’re probably getting offset conflated with FOV, change that property instead if required and set the camera to first person mode as the above post has shown how to do.

First person with an offset makes no sense if you think about it.