#How would I go about filtering inputs into the table they need to go in.

1 messages · Page 1 of 1 (latest)

silent sigil
#

READ BOTTOM INFO FIRST

keystrokeHandler.InputToQuery = function(keystrokeTable, state)
    Service.uis.InputBegan:Connect(function(input, processed)
        if processed or input.UserInputType ~= Enum.UserInputType.Keyboard or not allowedKeys[input.KeyCode] then
            return
        end
        
        
        table.insert(state.inputQueue, input.KeyCode)
        print(state.inputQueue)
        if #state.inputQueue >= state.inputNumber then
            keystrokeHandler.FindKeystrokeInput(keystrokeTable, state)
        end

        if not state.elapsedRunning then
            keystrokeHandler.RemoveInputQueueManager(state)
        end

    end)
end

I'd assume this is enough context, the code itself has no issues until you have more than one call of this function at the same time, like this for example:

keystrokeHandler.InputToQuery(keystrokeTable, keystrokeVars)
keystrokeHandler.InputToQuery(keystrokeTable2, keystrokeVars2)

each keystrokeTable has its own keystrokeVars, but the important thing is in keystrokeVars where there's an empty input query table.

inputQuery = {}

now the thing is that the script has no filter, and since every input is going through the same InputBegan listener, all InputQuery tables will get the same input in them (which is a problem in what my code is doing.), so I was wondering how I could go about coding a filter/safeguard to make sure inputs go only to inputQuery tables they're needed in.

wheat cryptBOT
#

studio** You are now Level 1! **studio

fallen furnace
#

damn 💀 why you just throw it to him like that

fossil marten
#

The delete button is there for a reason 😞 don’t scold me sur

fallen furnace
#

nah just like let him figure a lil I'm not scolding mb

fossil marten
#

Alright alright

fallen furnace
#

lol

fossil marten
#

@silent sigil

silent sigil
#

yea my question is how I'd go about fixing that

fallen furnace
#

ur allowedKeys[input.KeyCode] correctly gets the right key but doesn't lookup the correct values from keystrokeTable instead create a lookup table and directly figure whether it is in your lookupTable (allowedSet) or not. Else, throw return

#
local lookUp = {}
for _, key in ipairs(keystrokeTable) do
  lookUp[key]= true
end
if processed or input.UserInputType ~= Enum.UserInputType.Keyboard
  or not lookUp[input.KeyCode] then
    return
end
...