Camera movement locking

Step 1:

Copy this script. This script disables the right mouse button to drag the camera. From @colbert2677

Then disable the EnableMouseLockOption in the StarterPlayer service.

I have a question. Does your camera also rotate up and down?

1 Like

Let me try really quick, I will reply once I have tried.

Wait. In the first person, you can move the camera with your left click. I think I made a mistake.

Yeah, I was about to tell you, it’s first person and you can move the camera with your mouse. I just want to disable the mouse all together.

Hmm, I think I got it.

First, you add a ScreenGui. Then a TextButton with the size of 1,0,1,0. Then make the background invisible and activate the Modal bool value. Then delete the Text. That makes the mouse move freely and you can’t rotate the camera with the mouse anymore.

3 Likes

Alright, Ill try this method! Thank you.

Don’t forget to enable IgnoreGuiInset.

Edit: optional

I didn’t, and it works. Thank you!

Also, do you know how to make the camera look up a little bit? It looks down when it starts.

I searched and found this:

From @ReturnedTrue

3 Likes

Hello!
Sorry for my English, I use translator
I would like to suggest another method - just change the camera type from “Custom” to “Scriptable”, stop the player and that’s it! And this solution will take you only 1 line

workspace.CurrentCamera.Cameratype=Enum.CameraType.Scriptable

and back

workspace.CurrentCamera.Cameratype=Enum.CameraType.Custom

Well, if you want the camera to follow the head with the same angle, then just update the CFrame

workspace.CurrentCamera.CameraType=Enum.CameraType.Scriptable
head=game.Players.LocalPlayer.Character.Head
PlayerLook = workspace.CurrentCamera.CFrame.LookVector

game:GetService("RunService").Heartbeat:Connect(function()
	workspace.CurrentCamera.CFrame =CFrame.new(head.Position, head.Position+PlayerLook)
end)

I don’t know yet why make everything so complicated :slight_smile: ?

But that makes the player look down a bit. And isn’t the CameraType set to Scriptable in default?

1 Like

Oh! Believe me, the default camera type is clearly “Custom”.(CameraType | Roblox Creator Documentation)

What do you mean when you say “player go down”?

I meant that the player will look down a little bit.

Sorry, I don’t quite understand what you’re talking about. But if there are any deviations, then just compensate them with the necessary offset.

offset = nil 
workspace.CurrentCamera.CFrame =CFrame.new(head.Position+offset, head.Position+PlayerLook+offset)

It’s best to just change the camera’s CameraType to Scriptable.

My CameraType is set to Scriptable by default. But you can still add the line if your CameraType isn’t set to Scriptable.

I have already mentioned this! Everything is different here~ The author of this post clearly wants to simply disable the camera offset with the mouse, and not the entire camera. So I have to manually drag it over the player’s head

its fine, i already got it. dw.

1 Like