What do you think about my module, for input?

The key pressing detection, works like in unity.
It gives you a bool, if the key or button,
is being pressed at the moment, it will return “true”.

How to get input?
Just call one of the functions, under this text.

local RunService = game:GetService("RunService")
local Input = require(script:WaitForChild("HotkeyModule"))

RunService.RenderStepped:Connect(function()
       local IsKPressed = Input.getKey(Enum.Keycode.K)
       local IsMouseButton1Pressed = Input.getButton(Enum.UserInputType.MouseButton1)
       if IsKPressed then
            print("K key has been pressed!")
       end
       if IsMouseButton1Pressed then
            print("Left mouse button has been pressed!")
       end
end)

Also please, propose me, what should i add or change.

1 Like

Gotta show what’s going on in the HotkeyModule if you want feedback.

1 Like

https://developer.roblox.com/en-us/api-reference/function/UserInputService/IsKeyDown
https://developer.roblox.com/en-us/api-reference/function/UserInputService/IsMouseButtonPressed
https://developer.roblox.com/en-us/api-reference/function/UserInputService/IsGamepadButtonDown

1 Like

One thing, can you run this outside of UIS event or not?

1 Like

Yes. These functions exist as GETTER methods, which instantly return a value.