local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input, gameProccessedEvent)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.Up then
--function
end
end
end)
I have provided the script and I am intending for it to happen when the key is lifted and the Up/Down arrows work but I am only having issues with Left/Right keys
local USI = game:GetService("UserInputService")
local UpPressed = false
local DownPressed = false
local LeftPressed = false
local RightPressed = false
local function GetCool(Input)
if Input.UserInputType == Enum.UserInputType.Keyboard then
if Input.KeyCode == Enum.KeyCode.Up then
UpPressed = true
print("Up Pressed!")
elseif Input.KeyCode ~= Enum.KeyCode.Down then
UpPressed = false
print("Up Not Pressed!")
end
if Input.KeyCode == Enum.KeyCode.Down then
DownPressed = true
print("Down Pressed!")
elseif Input.KeyCode ~= Enum.KeyCode.Up then
DownPressed = false
print("Down Not Pressed!")
end
if Input.KeyCode == Enum.KeyCode.Left then
LeftPressed = true
print("Left Pressed!")
elseif Input.KeyCode ~= Enum.KeyCode.Right then
LeftPressed = false
print("Left Not Pressed!")
end
if Input.KeyCode == Enum.KeyCode.Right then
RightPressed = true
print("Right Pressed!")
elseif Input.KeyCode ~= Enum.KeyCode.Left then
RightPressed = false
print("Right Not Pressed!")
end
end
end
USI.InputEnded:connect(function(Input)
GetCool(Input)
end)
local USI = game:GetService("UserInputService")
local UpPressed = true
local DownPressed = true
local LeftPressed = true
local RightPressed = true
local function GetCool(Input)
if Input.UserInputType == Enum.UserInputType.Keyboard then--and Input.KeyCode == Enum.KeyCode.Up or Input.KeyCode == Enum.KeyCode.Down or Input.KeyCode == Enum.KeyCode.Right or Input.KeyCode == Enum.KeyCode.Left then
if Input.KeyCode == Enum.KeyCode.Up then
UpPressed = true
print("Up Pressed!")
elseif Input.KeyCode == Enum.KeyCode.Down then
UpPressed = false
print("Up Not Pressed!")
end
if Input.KeyCode == Enum.KeyCode.Down then
DownPressed = true
print("Down Pressed!")
elseif Input.KeyCode == Enum.KeyCode.Up then
DownPressed = false
print("Down Not Pressed!")
end
if Input.KeyCode == Enum.KeyCode.Left then
LeftPressed = true
print("Left Pressed!")
elseif Input.KeyCode == Enum.KeyCode.Right then
LeftPressed = false
print("Left Not Pressed!")
end
if Input.KeyCode == Enum.KeyCode.Right then
RightPressed = true
print("Right Pressed!")
elseif Input.KeyCode == Enum.KeyCode.Left then
RightPressed = false
print("Right Not Pressed!")
end
end
end
USI.InputEnded:connect(function(Input)
GetCool(Input)
end)
This would not work since I am forcing the player to press “Up > Down > Left > Right” since these have no checks for if the keys are pressed in the correct order.
The Left and Right Arrow Keys are grabbed by the camera and uses UserInputService as well,
ie. They aren’t bound with ContextActionService.
But there is a flag that can prevent the camera from grabbing the left and right arrows for panning.
You’ll have to grab the activeCameraController and then set its .keyPanEnabled to false.
(Something to research, or maybe someone else will take the time to explain it more.)
Hey i know this topic conversation was inactive for a while but, i have the same problem and i can’t find any other topics about how to get activeCameraController, can you tell the way you made your code run successfully or link the topic you have viewed ?
There seems to be no documentation at all about activeCameraController and .keyPanEnabled … could you explain how you fixed this issue?? This is extremely frustrating as I can’t find any help online
Please note that my above-mentioned solution to disable the Camera-pan keys is obsolete–
Now the PlayerScripts/StarterPlayerScripts/PlayerModule/CameraModule/... scripts
use ContextActionService keybindings, so you can simply now use CAS:BindActionAtPriority()
with a higher priority than Enum.ContextActionPriority.Default.Value to use your left & right arrows ( Enum.KeyCode.Left / Enum.KeyCode.Right ) for something else.