How do you store player input effectively?

I’m trying to implement a module that tracks player inputs to send to the server for usage but ran into a problem where every key press would register as a key hold even if I quickly tapped my key. Here is the block of code that handles that:

	uis.InputBegan:Connect(function(input, gpe)
        if gpe then return end
        if uis:IsKeyDown(input.KeyCode) then
            self._inputs[player.Name]["Holding"] = input.KeyCode.Name
        else
			self._inputs[player.Name]["Pressed"] = input.KeyCode.Name
        end
    end)
    uis.InputEnded:Connect(function(_, gpe)
        if gpe then return end
        self._inputs[player.Name] = {}
    end)

How would I fix this issue, as well as make it able to store the held key while the player presses other keys without voiding it?

thanks in advance.

1 Like