Detect a key being held after getting Input

I’m making a dash that changes depending on what movement key you are pressing (W,A,S,D), but I don’t know if there’s a way to check if one of those movement keys is being pressed once the dash keybind is pressed.

To know if a key is being pressed you should use UserInputService:IsKeyDown(). You can do something like this by using the character’s CFrame to achieve what you want to do:

local UIS = game:GetService("UserInputService")

local Directions = {
	["W"] = function(cf: CFrame)
		return cf.LookVector
	end,
	["A"] = function(cf: CFrame)
		return -cf.RightVector
	end,
	["S"] = function(cf: CFrame)
		return -cf.LookVector
	end,
	["D"] = function(cf: CFrame)
		return cf.RightVector
	end
}

local function GetDirection(cf: CFrame)
	local Direction = Vector3.new()
	
	for key, func in pairs(Directions) do
		if UIS:IsKeyDown(Enum.KeyCode[key]) then
			Direction += func(cf)
		end
	end
	
	return Direction
end