So I’m Trying To Make it So I Disable S, W, The UpArrow, and The DownArrow Movement, and I’m Wanting to Make it so The player can go left and right with the left and right arrow keys. I’m trying to make a Infinite 2D Obby.
Sorry, I need help a lot of help…

You would set their humanoidrootpart to anchored. Gonna write up a script
@JustAGameDeveloper1 How do I Do that?

Player = game.Players.LocalPlayer
Character = Player.Character or Player.CharacterAdded:Wait()
HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
UIS = game.UserInputService
UIS.InputBegan:Connect(function(input,gameProcessedEvent)
if gameProcessedEvent then return end
if input.KeyCode == Enum.KeyCode.W then
HumanoidRootPart.Anchored = true
end
end)
UIS.InputBegan:Connect(function(input,gameProcessedEvent)
if gameProcessedEvent then return end
if input.KeyCode == Enum.KeyCode.S then
HumanoidRootPart.Anchored = true
end
end)
UIS.InputBegan:Connect(function(input,gameProcessedEvent)
if gameProcessedEvent then return end
if input.KeyCode == Enum.KeyCode.A then
HumanoidRootPart.Anchored = false
end
end)
UIS.InputBegan:Connect(function(input,gameProcessedEvent)
if gameProcessedEvent then return end
if input.KeyCode == Enum.KeyCode.D then
HumanoidRootPart.Anchored = false
end
end)
@JustAGameDeveloper1 Where do I put It?
StarterGUI, localscript
But The Player could if they are falling press W or S and they would stop.
Since roblox uses ContextActionService for user inputs (a,w,s,d, arrow up, arrow down) you can disable them there. But there’s a few methods for going about it, such as:
local ContextActionService = game:GetService("ContextActionService")
local actionName = "CancelMovement"
-- // This will be used as a filler functions in this case
local function emptyFunc() end
ContextActionService:BindAction(actionName, emptyFunc, false, Enum.KeyCode.W, Enum.KeyCode.S, Enum.KeyCode.Up, Enum.KeyCode.Down)
To remove this lock, all you’d need to do is ContextActionService:UnbindAction(actionName).
Additionally to what @km7dev Posted.
@Kitsomia But How do I Make it so You can also go left and right with the left and right arrow keys?
Personally, I’m a little stumped on this one, I tried to do some digging and context action service has :CallFunction() locked to only core functions. And I personally have not done this myself. You may need to create your own custom method for detecting a left and right movement for the right and left arrow.
A basic idea to get started could be running a render stepped function grabbing all current keys pressed to make sure the user is pressing either Left Arrow or Right Arrow keys game:GetService("UserInputService"):GetKeysPressed(). Then applying a force to the players humanoid root part (relatively how roblox does this) Humanoid:ApplyImpulse(Direction :: Vector3). You may need to experiment with this.