Keybind

Captures a key from the user, then calls you every time it is pressed.

The smallest keybind#

Luau
main:Keybind({
    Text = "Toggle aimbot",
    Callback = function()
        aimbot = not aimbot
    end,
})

Click the control, press a key, and it is bound. Callback runs on every press of that key from then on.

Live preview

My Script

v1.0

Panic key

Building it up#

Pick a starting key:

Luau
main:Keybind({
    Text = "Toggle aimbot",
    Default = Enum.KeyCode.E,
    Callback = toggleAimbot,
})

React to rebindingChanged fires when the user picks a new key, which is different from the key being pressed:

Luau
main:Keybind({
    Text = "Toggle aimbot",
    Default = Enum.KeyCode.E,
    Callback = toggleAimbot,
    Changed = function(key)
        print("now bound to", key.Name)
    end,
})

Remember it:

Luau
main:Keybind({
    Text = "Toggle aimbot",
    Default = Enum.KeyCode.E,
    Save = "aimbotKey",
    Callback = toggleAimbot,
})

Every option#

OptionTypeDefaultWhat it does
TextreqstringThe label.
CallbackfunctionCalled each time the bound key is pressed.
DefaultEnumItemThe starting key, e.g. Enum.KeyCode.E.
Changedfunction(EnumItem)Called when the user binds a different key.
DescriptionstringA quieter second line.
IconstringAn icon shown before the label.
HoverColorColor3Overrides the hover tint.
HoverFillnumberHow strongly the hover state fills, 0 to 1.
SavestringPersist the bound key under this key.

Methods#

MethodReturnsWhat it does
Get()EnumItemThe currently bound key
Set(keyCode)Rebinds it
Luau
local bind = main:Keybind({ Text = "Toggle", Default = Enum.KeyCode.E })
 
bind:Get()                        --> Enum.KeyCode.E
bind:Set(Enum.KeyCode.RightAlt)   -- rebinds

This is not the window's own keybind

The key that hides and shows the whole window is set on Ember.new with its Keybind option, and defaults to RightShift. A Keybind control is for your script's own actions.