How to make motion inputs?

I’ve been trying to figure out how to make motion inputs for a fighting game although I just haven’t been able to figure it out in-fact I kind of don’t even fully know how it works I’ve tried doing some research and apparently there’s a thing called buffering which waits or queues inputs before doing them or at least I think that’s what it is. Anyways looking for some help on how I can make motion inputs.

It’s not much, but here’s what I’ve done

--| Services
local UIS = game:GetService("UserInputService")

--| Modules
local CharacterSpecific = require(script:WaitForChild("ModuleScript"))

--| Variables
local Inputs = {}
--These are the base controls. Every character access to punches and kicks.
local Controls = {
	["B"] = function()
		warn("Medium Kick")
	end,
	["N"] = function()
		warn("Light Kick")
	end,
	["G"] = function()
		warn("Light Punch")
	end,
	["H"] = function()
		warn("Medium Punch")
	end,
	--Apparently doing this is better than table.find sooo ignore these they don't do anything
	["W"] = function()
	end,
	["A"] = function()
	end,
	["S"] = function()
	end,
	["D"] = function()
	end,
}

--[[
coroutine.wrap(function()
	while wait() do
		if #Inputs ~= 0 then
			local Old = Inputs
			wait(0.5)
			if #Inputs == #Old then
				Inputs = {}
				warn("RESET")
			end			
		end
	end
end)()
]]

UIS.InputBegan:Connect(function(Input,IsTyping)
	if IsTyping then return end
	local Key = UIS:GetStringForKeyCode(Input.KeyCode)
	if Controls[Key] then
		table.insert(Inputs,Key) --insert the key pressed into the table
		local String = table.concat(Inputs) --turn the table into a string (not sure if this is helpful I just have it here just in case)
		warn(Inputs)
		warn("PREVIOUS INPUT: "..Inputs[#Inputs-1])
		warn("NEW INPUT: "..Inputs[#Inputs])
		
		--[[
		if CharacterSpecific.Moves[String] then
			CharacterSpecific.Moves[String]()
		elseif Controls[Key] then
			Controls[Key]()
		end

		for Combo,_ in pairs(CharacterSpecific.Moves) do
			if String:find(Combo) then
				CharacterSpecific.Moves[Combo]()
				Inputs = {}
			end
		end	
		]]
	end
end)
local module = {}

--These are specific inputs unique to the character
module.Moves = {
	["SG"] = function()
		warn("Move 1")
	end,
	["ASDB"] = function()
		warn("Move 2")
	end,
	["DSAG"] = function()
		warn("Move 2")
	end,
}

return module

if you find you are stuck understanding how a piece of code works put a print statement in after each code line (where possible) to print out where you are in the script and the values of any variables that have been changed.
This will result in a road map of the process and may be helpful.

Oh my bad I probably should have worded this better, but I know how the code works lol I was saying that I didn’t know how a motion input system works and what I mean by motion inputs is if you ever played Street Fighter for a example that has motion inputs. For example having to do a quarter circle and a punch button to perform a certain move.

Ok, so what do you get in the output when it runs?

Depending on what the string equals it will print whatever is inside the functions. So if I press A,S,D,B those keys will be added to the table which then gets turned into a string which would be "ASDB" and is then found in module.Moves however the issue with this is there’s also "B" in local Controls so it will print Medium Kick and Move 2 not sure how to work around that.

How are the actual moves being processed?
For example if I press A S D B without any ‘batching’ I would expect to move westward, backward, right and whatever B was assigned to do.
Are you processing the movements in your own code or injecting the letters into the keyboard stream?

Not sure what you mean, but I’m not doing anything with the movement right now so yeah if you hit A,S,D you’re gonna move in those direction and B doesn’t do anything besides just printing “Medium Kick”. I’m just trying to figure out how to do this style of input