Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to disable camera movement with "<" and ">" key?

Whenever you use the keys "<" and ">", ROBLOX rotates your camera by 90 degrees in its respective direction. Is there any way to prevent this?

4 comments

0

I would think setting the CurrentCamera to scriptable would do it.

0

That comes with a whole new set of problems, I'd have to completely remake the camera follow script...

0

pressing < and > doesn't do anything to the camera... Do you mean , and . ?

0

Period, and "<" share key on my keyboard lol

3 answers

✓ Accepted answer

An alternative would be to copy the default control scripts and modify them slightly. Here's a step-by-step:

  1. Play a game in studio so that your character spawns.
  2. Copy the CameraScript found under game.Players.Player.PlayerScripts.
  3. 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.
  4. 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

0

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.