input

Mouse

The mouse library provides functions to simulate mouse actions and check the state of mouse buttons.

Important Notes:

  • Button Names: All functions accept either a string name (e.g., "leftmouse", "mouse4") or the raw integer virtual-key code for the button. String names are case-insensitive.

  • Key Names:

    • "leftmouse" (or VK_LBUTTON)

    • "rightmouse" (or VK_RBUTTON)

    • "middlemouse" (or VK_MBUTTON)

    • "mouse4" (or VK_XBUTTON1)

    • "mouse5" (or VK_XBUTTON2)

  • Naming Conventions: All functions support PascalCase, camelCase, and snake_case.


Click

Simulates a single, complete mouse click (a press followed immediately by a release). This is useful for automating UI interactions or firing weapons.

  • Aliases: mouse.Click, mouse.click

  • Signature: mouse.Click(button)

  • Parameters:

    • button: string|integer - The button to click.

  • Example:

    -- In a callback or loop, this would simulate clicking the left mouse button.
    mouse.click("leftmouse")

IsClicked

Checks if a mouse button was pressed since the last time this function was called for that button. This is ideal for single-press actions like toggling a menu, as it only returns true for one frame per click.

  • Aliases: mouse.IsClicked, mouse.isClicked, mouse.is_clicked

  • Signature: mouse.IsClicked(button)

  • Parameters:

    • button: string|integer - The button to check.

  • Returns: boolean - true if the button was just pressed, otherwise false.

  • Example:

    local menu_is_open = false
    
    cheat.register("onPaint", function()
        -- Use IsClicked to toggle the menu on a single press of the side mouse button
        if mouse.is_clicked("mouse4") then
            menu_is_open = not menu_is_open
            print("Menu toggled:", menu_is_open)
        end
    
        if menu_is_open then
            draw.text("Menu is Open", 100, 100, Color3.new(1, 1, 1))
        end
    end)

Scroll

Simulates scrolling the mouse wheel up or down.

  • Aliases: mouse.Scroll, mouse.scroll

  • Signature: mouse.Scroll(delta)

  • Parameters:

    • delta: integer - The amount and direction to scroll. A positive value (e.g., 1) scrolls up, and a negative value (e.g., -1) scrolls down. The magnitude can be increased for faster scrolling.

  • Example:

    -- This would simulate scrolling the wheel down by one "tick".
    mouse.scroll(-1)

Keyboard

The keyboard library provides functions to simulate key presses and check the state of keyboard keys.

Important Notes:

  • Key Names: Functions accept common string names (e.g., "space", "f5", "lshift") or the raw integer virtual-key code. String names are case-insensitive.

  • Naming Conventions: All functions support PascalCase, camelCase, and snake_case.


Press

Simulates pressing a key down and holding it. The key will remain in a "down" state until keyboard.Release is called.

  • Aliases: keyboard.Press, keyboard.press

  • Signature: keyboard.Press(key)

  • Parameters:

    • key: string|integer - The key to press.

  • Example:

    -- Make the character walk forward by holding the 'W' key.
    keyboard.press("w")

Release

Simulates releasing a key that was previously held down.

  • Aliases: keyboard.Release, keyboard.release

  • Signature: keyboard.Release(key)

  • Parameters:

    • key: string|integer - The key to release.

  • Example:

    -- Stop walking forward.
    keyboard.release("w")

IsPressed

Checks if a key is currently being held down at the exact moment the function is called. This is different from mouse.IsClicked, as it will return true for every single frame the key is held. This is useful for continuous actions like sprinting.

  • Aliases: keyboard.IsPressed, keyboard.isPressed, keyboard.is_pressed

  • Signature: keyboard.IsPressed(key)

  • Parameters:

    • key: string|integer - The key to check.

  • Returns: boolean - true if the key is currently down, otherwise false.

  • Example:

    local is_sprinting = false
    
    cheat.register("onPaint", function()
        -- Check if Left Shift is being held down to enable sprinting.
        if keyboard.is_pressed("lshift") then
            is_sprinting = true
            -- (Here you would increase the player's walkspeed)
        else
            if is_sprinting then
                is_sprinting = false
                -- (Here you would reset the player's walkspeed to normal)
            end
        end
    
        if is_sprinting then
            draw.text("Sprinting!", 20, 20, Color3.new(1, 1, 0))
        end
    end)

Last updated