Whenever you use the keys "<" and ">", ROBLOX rotates your camera by 90 degrees in its respective direction. Is there any way to prevent this?
How to disable camera movement with "<" and ">" key?
3 answers
An alternative would be to copy the default control scripts and modify them slightly. Here's a step-by-step:
- Play a game in studio so that your character spawns.
- Copy the
CameraScriptfound undergame.Players.Player.PlayerScripts. - Stop the game. Paste the script into
game.StarterPlayer.StarterPlayerScripts. This will replace the default camera script whenever the player enters the game. Now you can start editing. - Go to the module
CameraScript.RootCamera. You should see something like this, starting at line 494:
--[[elseif input.KeyCode == Enum.KeyCode.Comma then
local angle = rotateVectorByAngleAndRound(this:GetCameraLook() * Vector3.new(1,0,1), -eight2Pi * (3/4), eight2Pi)
if angle ~= 0 then
this.RotateInput = this.RotateInput + Vector2.new(angle, 0)
this.LastUserPanCamera = tick()
this.LastCameraTransform = nil
end
elseif input.KeyCode == Enum.KeyCode.Period then
local angle = rotateVectorByAngleAndRound(this:GetCameraLook() * Vector3.new(1,0,1), eight2Pi * (3/4), eight2Pi)
if angle ~= 0 then
this.RotateInput = this.RotateInput + Vector2.new(angle, 0)
this.LastUserPanCamera = tick()
this.LastCameraTransform = nil
end]]
comment these statements out (I did it for you already). This should unbind the , and . keys from controlling your camera!
There's no real way to disable keys that are being used by roblox. You can try assigning the key to do something, but it won't really do anything.
You can use ContextActionService's BindAction method to get input from these keys, which will block ROBLOX's camera manipulation code from receiving them. Also keep in mind that they use the comma and period keys, not their shifted alternatives greater than and less than.
1 comment
Okay, I'm not quite sure how to use this (I didn't quite understand the wiki) so can you give me an example please? Also just to make sure, after I block ROBLOX from using the keys, could I use them for my own need?
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
I would think setting the CurrentCamera to scriptable would do it.
That comes with a whole new set of problems, I'd have to completely remake the camera follow script...
pressing < and > doesn't do anything to the camera... Do you mean , and . ?
Period, and "<" share key on my keyboard lol