How can i turn off WASD buttons, but UIS server worked

Dear developers,

I used this script, in LocalScript.
The WASD keys no longer work as I wanted them to.
But also, the UIS service stopped working for me (only for WASD keys)

How can I make it so that I can’t use the WASD keys for movement, but the UIS service works for those keys?

Script:

local ContextAction = game:GetService("ContextActionService")

function sinkInput()
	return Enum.ContextActionResult.Sink
	-- Sinks the key so that no action is taken.
	-- Since this will be the most recent bind to the key, it takes priority over default movement.
end

-- Disables movement.
function disableMovement()
	ContextAction:BindAction("DisableMovement", sinkInput, false, 
		Enum.KeyCode.W,
		Enum.KeyCode.A,
		Enum.KeyCode.S,
		Enum.KeyCode.D
	)
end

disableMovement()
sinkInput()
1 Like

The ways with - Humanoid.WalkSpeed = 0 and HumanoidRootPart.Anchored = true

don’t work for me, I need to turn these keys off.

Maybe there’s some way to change just the assignment of these keys, for example, to arrows.
But at the same time UIS on the WASD buttons worked

local ContextActionService = game:GetService("ContextActionService")
ContextActionService:UnbindAction("moveForwardAction")
ContextActionService:UnbindAction("moveBackwardAction")
ContextActionService:UnbindAction("moveLeftAction")
ContextActionService:UnbindAction("moveRightAction")
2 Likes

tysm!
Turns out it wasn’t that hard. >:)

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.