Camera not being still

I’m trying to make the camera have an offset from the character. And I want it to be still and follow the player without it twisting and rotating whenever the player turns.

I’ve tried to make the cam look at the humanoid root part, but it didnt really work. Here’s the local script I have the camera.

local char = script.Parent
local cam = workspace.CurrentCamera

cam.CameraType = Enum.CameraType.Scriptable
while true do
	task.wait()
	
	local lookAtCFRAME = CFrame.lookAt(char.PrimaryPart.Cam.Position, char.PrimaryPart.Position)
	
	cam.CFrame = lookAtCFRAME
	
end

3 Likes

Try searching ‘shoulder cam’. I’ve seen other posts on the forums.
I thing your camera shouldn’t be lookAt, it should just be a CFrame offset.

1 Like

Okay, also I’ve tried it to just be cam.CFrame = the offset, but it was the same.

1 Like

Do you want it to follow the player, but stay pointing in the same world direction?
Here are the styles of CameraType

1 Like

Yes, i want it to follow the player but staying pointing in the same world direction.
Using diffeent camera types don’t seem to be working though, prob because my cam is 45 degrees and behind the player.

So basically CameraType Track in the documentation?

1 Like

That doesn’t work. It still turns whenever I move.

1 Like

I think I know the solution:

You need to use the humanoid’s cameraoffset property.

local char = script.Parent
local cam = workspace.CurrentCamera

char.Humanoid.CameraOffset = Vector3.new(2,0,0) -- Example
1 Like

That’s strange. it’s not how it’s supposed to work.
cam.CameraType = Enum.CameraType.Track

1 Like

I know I am an hour late, but how would i be able to prevent the user from turning the camera?

1 Like

If you put the camera type to scriptable, they won’t be able to turn. Because there won’t be any default behaviour.

1 Like

And now the camera doesn’t move, and I’m back to square one.

What you could do is add an empty local script into startercharacterscripts named “CameraScript” which will automatically disable roblox’s custom camera stuff.

Maybe that would work.

Nope, it doesn’t work. Even with the other script disabled.

1 Like

Does this work?

local char = script.Parent
local cam = workspace.CurrentCamera

cam.CameraType = Enum.CameraType.Track

No need to help anymore, I’ve fixed it.

Nice.
To keep people from trying to Solve this post again in the future please mark the post that fixed it as the Solution.
If the Solution wasn’t on here then please post how you solved it so others with the same problem searching the forums can find your answer.
:smiley:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.