pyrobloxbot

pyrobloxbot public API exports.

pyrobloxbot.reset_player(interval: float = 0) None

Resets the player character.

Parameters:

interval (float, optional) –

How long to wait in between each key press. Defaults to 0.

Usually it should be fine, but change it to a higher value if you find it unreliable.

pyrobloxbot.chat(message: str) None

Sends a message in chat.

Parameters:

message (str) – The message to send.

pyrobloxbot.equip_slot(slot: int) None

Equips a hotbar slot.

Parameters:

slot (int) – The number of the slot to equip. Must be between 0 and 9.

Raises:

ValueError – Raised when the slot number isn’t between 0 and 9.

pyrobloxbot.toggle_shift_lock() None

Toggles shift lock.

Note

Shift lock switch must be enabled in Roblox settings

pyrobloxbot.enable_shift_lock() None

Enables shift lock. If shift lock is already enabled, does nothing.

Note

Shift lock switch must be enabled in Roblox settings.

pyrobloxbot.disable_shift_lock() None

Disables shift lock. If shift lock is already disabled, does nothing.

Note

Shift lock switch must be enabled in Roblox settings.

pyrobloxbot.toggle_inventory() None

Toggles the inventory.

pyrobloxbot.open_inventory() None

Opens the inventory. If the inventory is already open, does nothing.

pyrobloxbot.close_inventory() None

Closes the inventory. If the inventory is already closed, does nothing.

pyrobloxbot.image_is_visible(image_path: str, confidence: float = 0.9) bool

Checks whether a given image is visible on screen.

Important

Be aware that the screenshots are dpi aware.

This means that a screenshot taken on one monitor might not be the same physical size as taken in another monitor, meaning the method might not find it.

Being in fullscreen has the same effect.

It is recommended to use screenshots taken on the monitor where Roblox will be running.

Parameters:
  • image_path (str) – The path of the image to check

  • confidence (float, optional) –

    How confident the method must be to return True. Be aware that low confidence values (<0.5) might start giving you false positives.

    Defaults to 0.9.

Returns:

Whether or not the image is visible.

Return type:

bool

pyrobloxbot.wait_for_image(image_path: str, confidence: float = 0.9, timeout: int | None = None, continue_after_timeout: bool = False) bool

Sleep until a given image is visible on screen.

Important

Be aware that the screenshots are dpi aware.

This means that a screenshot taken on one monitor might not be the same physical size as taken in another monitor, meaning the method might not find it.

Being in fullscreen has the same effect.

It is recommended to use screenshots taken on the monitor where Roblox will be running.

Parameters:
  • image_path (str) – The path of the image to check

  • confidence (float, optional) –

    How confident the method must be to return True. Be aware that low confidence values (<0.5) might start giving you false positives.

    Defaults to 0.9.

  • timeout (Optional[int], optional) –

    A timeout in seconds, after which the function stops waiting for the image. If set to None, it will wait indefinitely.

    Defaults to None.

  • continue_after_timeout (bool, optional) –

    If set to False, the function will raise pyrobloxbot.exceptions.ImageTimeoutExpired when the timeout expires.

    If set to True, it will just stop sleeping without raising anything.

    Defaults to False.

Raises:

ImageTimeoutExpired – Raised when the timeout expires and continue_after_timeout is False

Returns:

True if the image was found, or False if the timeout expired.

Return type:

bool

pyrobloxbot.press_key(*keys: Literal['\t', '\n', '\r', ' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 'accept', 'add', 'alt', 'altleft', 'altright', 'apps', 'backspace', 'browserback', 'browserfavorites', 'browserforward', 'browserhome', 'browserrefresh', 'browsersearch', 'browserstop', 'capslock', 'clear', 'convert', 'ctrl', 'ctrlleft', 'ctrlright', 'decimal', 'del', 'delete', 'divide', 'down', 'end', 'enter', 'esc', 'escape', 'execute', 'f1', 'f10', 'f11', 'f12', 'f13', 'f14', 'f15', 'f16', 'f17', 'f18', 'f19', 'f2', 'f20', 'f21', 'f22', 'f23', 'f24', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'final', 'fn', 'hanguel', 'hangul', 'hanja', 'help', 'home', 'insert', 'junja', 'kana', 'kanji', 'launchapp1', 'launchapp2', 'launchmail', 'launchmediaselect', 'left', 'modechange', 'multiply', 'nexttrack', 'nonconvert', 'num0', 'num1', 'num2', 'num3', 'num4', 'num5', 'num6', 'num7', 'num8', 'num9', 'numlock', 'pagedown', 'pageup', 'pause', 'pgdn', 'pgup', 'playpause', 'prevtrack', 'print', 'printscreen', 'prntscrn', 'prtsc', 'prtscr', 'return', 'right', 'scrolllock', 'select', 'separator', 'shift', 'shiftleft', 'shiftright', 'sleep', 'space', 'stop', 'subtract', 'tab', 'up', 'volumedown', 'volumemute', 'volumeup', 'win', 'winleft', 'winright', 'yen', 'command', 'option', 'optionleft', 'optionright']) None

Presses the given keys in order

Parameters:

*keys (KEYBOARD_KEYS) – The keys to be pressed

pyrobloxbot.hold_key(*keys: Literal['\t', '\n', '\r', ' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 'accept', 'add', 'alt', 'altleft', 'altright', 'apps', 'backspace', 'browserback', 'browserfavorites', 'browserforward', 'browserhome', 'browserrefresh', 'browsersearch', 'browserstop', 'capslock', 'clear', 'convert', 'ctrl', 'ctrlleft', 'ctrlright', 'decimal', 'del', 'delete', 'divide', 'down', 'end', 'enter', 'esc', 'escape', 'execute', 'f1', 'f10', 'f11', 'f12', 'f13', 'f14', 'f15', 'f16', 'f17', 'f18', 'f19', 'f2', 'f20', 'f21', 'f22', 'f23', 'f24', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'final', 'fn', 'hanguel', 'hangul', 'hanja', 'help', 'home', 'insert', 'junja', 'kana', 'kanji', 'launchapp1', 'launchapp2', 'launchmail', 'launchmediaselect', 'left', 'modechange', 'multiply', 'nexttrack', 'nonconvert', 'num0', 'num1', 'num2', 'num3', 'num4', 'num5', 'num6', 'num7', 'num8', 'num9', 'numlock', 'pagedown', 'pageup', 'pause', 'pgdn', 'pgup', 'playpause', 'prevtrack', 'print', 'printscreen', 'prntscrn', 'prtsc', 'prtscr', 'return', 'right', 'scrolllock', 'select', 'separator', 'shift', 'shiftleft', 'shiftright', 'sleep', 'space', 'stop', 'subtract', 'tab', 'up', 'volumedown', 'volumemute', 'volumeup', 'win', 'winleft', 'winright', 'yen', 'command', 'option', 'optionleft', 'optionright'], duration: float) None

Hold the given keys for a given duration

Parameters:
  • *keys (KEYBOARD_KEYS) – The keys to hold

  • duration (float) – How long to hold the keys for

pyrobloxbot.keyboard_action(*keys: Literal['\t', '\n', '\r', ' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 'accept', 'add', 'alt', 'altleft', 'altright', 'apps', 'backspace', 'browserback', 'browserfavorites', 'browserforward', 'browserhome', 'browserrefresh', 'browsersearch', 'browserstop', 'capslock', 'clear', 'convert', 'ctrl', 'ctrlleft', 'ctrlright', 'decimal', 'del', 'delete', 'divide', 'down', 'end', 'enter', 'esc', 'escape', 'execute', 'f1', 'f10', 'f11', 'f12', 'f13', 'f14', 'f15', 'f16', 'f17', 'f18', 'f19', 'f2', 'f20', 'f21', 'f22', 'f23', 'f24', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'final', 'fn', 'hanguel', 'hangul', 'hanja', 'help', 'home', 'insert', 'junja', 'kana', 'kanji', 'launchapp1', 'launchapp2', 'launchmail', 'launchmediaselect', 'left', 'modechange', 'multiply', 'nexttrack', 'nonconvert', 'num0', 'num1', 'num2', 'num3', 'num4', 'num5', 'num6', 'num7', 'num8', 'num9', 'numlock', 'pagedown', 'pageup', 'pause', 'pgdn', 'pgup', 'playpause', 'prevtrack', 'print', 'printscreen', 'prntscrn', 'prtsc', 'prtscr', 'return', 'right', 'scrolllock', 'select', 'separator', 'shift', 'shiftleft', 'shiftright', 'sleep', 'space', 'stop', 'subtract', 'tab', 'up', 'volumedown', 'volumemute', 'volumeup', 'win', 'winleft', 'winright', 'yen', 'command', 'option', 'optionleft', 'optionright']) None

Presses the given keys in order

Parameters:

*keys (KEYBOARD_KEYS) – The keys to be pressed

pyrobloxbot.hold_keyboard_action(*keys: Literal['\t', '\n', '\r', ' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 'accept', 'add', 'alt', 'altleft', 'altright', 'apps', 'backspace', 'browserback', 'browserfavorites', 'browserforward', 'browserhome', 'browserrefresh', 'browsersearch', 'browserstop', 'capslock', 'clear', 'convert', 'ctrl', 'ctrlleft', 'ctrlright', 'decimal', 'del', 'delete', 'divide', 'down', 'end', 'enter', 'esc', 'escape', 'execute', 'f1', 'f10', 'f11', 'f12', 'f13', 'f14', 'f15', 'f16', 'f17', 'f18', 'f19', 'f2', 'f20', 'f21', 'f22', 'f23', 'f24', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'final', 'fn', 'hanguel', 'hangul', 'hanja', 'help', 'home', 'insert', 'junja', 'kana', 'kanji', 'launchapp1', 'launchapp2', 'launchmail', 'launchmediaselect', 'left', 'modechange', 'multiply', 'nexttrack', 'nonconvert', 'num0', 'num1', 'num2', 'num3', 'num4', 'num5', 'num6', 'num7', 'num8', 'num9', 'numlock', 'pagedown', 'pageup', 'pause', 'pgdn', 'pgup', 'playpause', 'prevtrack', 'print', 'printscreen', 'prntscrn', 'prtsc', 'prtscr', 'return', 'right', 'scrolllock', 'select', 'separator', 'shift', 'shiftleft', 'shiftright', 'sleep', 'space', 'stop', 'subtract', 'tab', 'up', 'volumedown', 'volumemute', 'volumeup', 'win', 'winleft', 'winright', 'yen', 'command', 'option', 'optionleft', 'optionright'], duration: float) None

Hold the given keys for a given duration

Parameters:
  • *keys (KEYBOARD_KEYS) – The keys to hold

  • duration (float) – How long to hold the keys for

pyrobloxbot.key_down(*keys: Literal['\t', '\n', '\r', ' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 'accept', 'add', 'alt', 'altleft', 'altright', 'apps', 'backspace', 'browserback', 'browserfavorites', 'browserforward', 'browserhome', 'browserrefresh', 'browsersearch', 'browserstop', 'capslock', 'clear', 'convert', 'ctrl', 'ctrlleft', 'ctrlright', 'decimal', 'del', 'delete', 'divide', 'down', 'end', 'enter', 'esc', 'escape', 'execute', 'f1', 'f10', 'f11', 'f12', 'f13', 'f14', 'f15', 'f16', 'f17', 'f18', 'f19', 'f2', 'f20', 'f21', 'f22', 'f23', 'f24', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'final', 'fn', 'hanguel', 'hangul', 'hanja', 'help', 'home', 'insert', 'junja', 'kana', 'kanji', 'launchapp1', 'launchapp2', 'launchmail', 'launchmediaselect', 'left', 'modechange', 'multiply', 'nexttrack', 'nonconvert', 'num0', 'num1', 'num2', 'num3', 'num4', 'num5', 'num6', 'num7', 'num8', 'num9', 'numlock', 'pagedown', 'pageup', 'pause', 'pgdn', 'pgup', 'playpause', 'prevtrack', 'print', 'printscreen', 'prntscrn', 'prtsc', 'prtscr', 'return', 'right', 'scrolllock', 'select', 'separator', 'shift', 'shiftleft', 'shiftright', 'sleep', 'space', 'stop', 'subtract', 'tab', 'up', 'volumedown', 'volumemute', 'volumeup', 'win', 'winleft', 'winright', 'yen', 'command', 'option', 'optionleft', 'optionright']) None

Puts down the given keys, in a non blocking way.

The keys will remain pressed until pyrobloxbot.key_up() is called for them.

Parameters:

*keys (KEYBOARD_KEYS) – The keys to put down

pyrobloxbot.key_up(*keys: Literal['\t', '\n', '\r', ' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 'accept', 'add', 'alt', 'altleft', 'altright', 'apps', 'backspace', 'browserback', 'browserfavorites', 'browserforward', 'browserhome', 'browserrefresh', 'browsersearch', 'browserstop', 'capslock', 'clear', 'convert', 'ctrl', 'ctrlleft', 'ctrlright', 'decimal', 'del', 'delete', 'divide', 'down', 'end', 'enter', 'esc', 'escape', 'execute', 'f1', 'f10', 'f11', 'f12', 'f13', 'f14', 'f15', 'f16', 'f17', 'f18', 'f19', 'f2', 'f20', 'f21', 'f22', 'f23', 'f24', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'final', 'fn', 'hanguel', 'hangul', 'hanja', 'help', 'home', 'insert', 'junja', 'kana', 'kanji', 'launchapp1', 'launchapp2', 'launchmail', 'launchmediaselect', 'left', 'modechange', 'multiply', 'nexttrack', 'nonconvert', 'num0', 'num1', 'num2', 'num3', 'num4', 'num5', 'num6', 'num7', 'num8', 'num9', 'numlock', 'pagedown', 'pageup', 'pause', 'pgdn', 'pgup', 'playpause', 'prevtrack', 'print', 'printscreen', 'prntscrn', 'prtsc', 'prtscr', 'return', 'right', 'scrolllock', 'select', 'separator', 'shift', 'shiftleft', 'shiftright', 'sleep', 'space', 'stop', 'subtract', 'tab', 'up', 'volumedown', 'volumemute', 'volumeup', 'win', 'winleft', 'winright', 'yen', 'command', 'option', 'optionleft', 'optionright']) None

Releases the given keys.

Parameters:

*keys (KEYBOARD_KEYS) – The keys to release.

pyrobloxbot.mouse_left_click()

Press the left mouse button wherever the mouse is.

pyrobloxbot.mouse_right_click()

Press the right mouse button wherever the mouse is.

pyrobloxbot.walk(*directions: Literal['f', 'fw', 'forward', 'forwards', 'b', 'bw', 'back', 'backward', 'backwards', 'l', 'left', 'r', 'right'], duration: float) None

Makes the character walk in the given directions for a certain time.

Parameters:
  • *directions (WALK_DIRECTIONS) – The directions to walk in. If two perpendicular directions are given, the bot won’t move in either.

  • duration (float) – How long to walk for.

Raises:

ValueError – Raised when the directions aren’t one of pyrobloxbot.constants.WALK_DIRECTIONS

pyrobloxbot.walk_forward(duration: float) None

Walks forward for a given time.

Parameters:

duration (float) – How long to walk for.

pyrobloxbot.walk_left(duration: float) None

Walks left for a given time.

Parameters:

duration (float) – How long to walk for.

pyrobloxbot.walk_right(duration: float) None

Walks right for a given time.

Parameters:

duration (float) – How long to walk for.

pyrobloxbot.walk_back(duration: float) None

Walks backwards for a given time.

Parameters:

duration (float) – How long to walk for.

pyrobloxbot.jump(number_of_jumps: int = 1, interval: float = 0) None

Jumps a given number of times.

Parameters:
  • number_of_jumps (int, optional) – How many times to jump. Defaults to 1.

  • interval (float, optional) – How long between each jump. Defaults to 0.

pyrobloxbot.jump_continuous(duration: float) None

Holds jump for a given time.

Parameters:

duration (float) – How long to hold jump for.

pyrobloxbot.leave_game(interval: float = 0) None

Leaves the current game.

Parameters:

interval (float, optional) –

How long to wait in between each key press. Defaults to 0.

Usually it should be fine, but change it to a higher value if you find it unreliable.

pyrobloxbot.join_game(game_id: int) None

Launches a Roblox game.

Note

The time it takes for the game to launch is entirely variable.

It is usually recommended to use pyrobloxbot.image_is_visible() to detect when the game has finished launching.

Parameters:

game_id (int) –

The id of the game to join.

This can be found in the url for the game, which has the format https://www.roblox.com/games/<Game Id>/<Game Name>. The game id will be a random looking number.

pyrobloxbot.join_user(user_id: int) None

Joins a user’s game. This is only possible if you’d normally be able to do so from the app.

Note

The time it takes for the game to launch is entirely variable.

It is usually recommended to use pyrobloxbot.image_is_visible() to detect when the game has finished launching.

Parameters:

user_id (int) –

The id of the user to join.

This can be found in the user’s profile link, which has the format https://www.roblox.com/users/<User Id>/profile. The user id will be a random looking number.

pyrobloxbot.join_private_server(game_id: int, private_server_link_code: int) None

Joins a private server given it’s private link code.

Note

The time it takes for the game to launch is entirely variable.

It is usually recommended to use pyrobloxbot.image_is_visible() to detect when the game has finished launching.

Parameters:
  • game_id (int) – The id of the private server’s game.

  • private_server_link_code (int) – The private server’s link code.

pyrobloxbot.join_server(game_id: int, job_id: str) None

Joins a particular server given it’s job id.

Note

The time it takes for the game to launch is entirely variable.

It is usually recommended to use pyrobloxbot.image_is_visible() to detect when the game has finished launching.

Parameters:
  • game_id (int) – The server’s game id.

  • job_id (str) – The server’s job id.

pyrobloxbot.find_servers(game_id: int, limit: Literal[10, 25, 50, 100] = 10, descending: bool = True, ignore_full_servers: bool = True) List[str]

Queries the Roblox api to find server ids for the given game.

Important

Be careful about using this function too often, because Roblox tends to rate limit you relatively quickly.

Parameters:
  • game_id (int) – The id of the game to find servers in.

  • limit (int, optional) – How many server ids to query for. Can only be 10, 25, 50 or 100. Defaults to 10.

  • descending (bool, optional) – If True, prioritizes fuller servers. If False, prioritizes emptier servers. Defaults to True.

  • ignore_full_servers (bool, optional) – Whether or not to ignore full servers in the results. Defaults to True.

Raises:
  • RobloxApiException – Raised whenever the Roblox api responds with an error.

  • requests.HTTPError – Raised whenever there’s an error during the HTTP request.

Returns:

A list of server ids.

Return type:

List[str]

pyrobloxbot.toggle_ui_navigation() None

Toggles the ui navigation mode.

Note

The “UI Navigation Toggle” setting must be enabled on Roblox.

pyrobloxbot.enable_ui_navigation() None

Enables the ui navigation mode. Does nothing if it’s already enabled.

Warning

This function relies on pyrobloxbot’s internal tracking of whether the ui navigation mode is enabled in game.

This can sometimes get desynced from what’s actually real in game, because clicking certain ui elements can turn off the ui navigation mode, and there’s no way to track that automatically.

Be careful of desyncs when using this function.

Note

The “UI Navigation Toggle” setting must be enabled on Roblox.

pyrobloxbot.disable_ui_navigation() None

Disables the ui navigation mode. Does nothing if it’s already disabled.

Warning

This function relies on pyrobloxbot’s internal tracking of whether the ui navigation mode is enabled in game.

This can sometimes get desynced from what’s actually real in game, because clicking certain ui elements can turn off the ui navigation mode, and there’s no way to track that automatically.

Be careful of desyncs when using this function.

Note

The “UI Navigation Toggle” setting must be enabled on Roblox.

pyrobloxbot.ui_navigate(*actions: Literal['up', 'u', 'left', 'l', 'right', 'r', 'down', 'd', 'click', 'c']) None

Executes the given ui actions in order.

This function is used for doing entire ui navigation sequences in a single function.

The actions can include navigating in any of the cardinal directions and clicking on the selected ui element.

Note

The ui navigation mode must be enabled.

Raises:

ValueError – Raised when any of the actions provided isn’t in pyrobloxbot.constants.UI_ACTIONS

pyrobloxbot.ui_navigate_up(times: int = 1) None

Navigates up in ui elements.

Note

The ui navigation mode must be enabled.

Parameters:

times (int, optional) – How many times to navigate up. Defaults to 1.

pyrobloxbot.ui_navigate_down(times: int = 1) None

Navigates down in ui elements.

Note

The ui navigation mode must be enabled.

Parameters:

times (int, optional) – How many times to navigate down. Defaults to 1.

pyrobloxbot.ui_navigate_left(times: int = 1) None

Navigates left in ui elements.

Note

The ui navigation mode must be enabled.

Parameters:

times (int, optional) – How many times to navigate left. Defaults to 1.

pyrobloxbot.ui_navigate_right(times: int = 1) None

Navigates right in ui elements.

Note

The ui navigation mode must be enabled.

Parameters:

times (int, optional) – How many times to navigate right. Defaults to 1.

pyrobloxbot.ui_click() None

Click on the currently selected ui element.

Note

The ui navigation mode must be enabled.

pyrobloxbot.ui_scroll_up(ticks: int, interval: float = 0.1) None

Scrolls up through selected ui element.

The ui element itself has to be scrollable. This means you have to have selected the scrollable frame, not one of the elements inside it.

Note

The ui navigation mode must be enabled.

Parameters:
  • ticks (int) – How many times to scroll

  • interval (float, optional) –

    The delay between each input. Defaults to 0.1.

    A lower delay will scroll faster but at some point can lose precision.

pyrobloxbot.ui_scroll_down(ticks: int, interval: float = 0.1) None

Scrolls down through selected ui element.

The ui element itself has to be scrollable. This means you have to have selected the scrollable frame, not one of the elements inside it.

Note

The ui navigation mode must be enabled.

Parameters:
  • ticks (int) – How many times to scroll

  • interval (float, optional) –

    The delay between each input. Defaults to 0.1.

    A lower delay will scroll faster but at some point can lose precision.

class pyrobloxbot.restore_focus

This is a context manager that allows you to execute bot actions inside it, and at the end restore the focus to the window that was previously active.

Example

Ran from the terminal, jump and say "Hello world!" in chat before returning to the terminal

>>> import pyrobloxbot as bot
>>> with bot.restore_focus():
...     bot.jump()
...     bot.chat("Hello world!")
pyrobloxbot.wait_for_focus(take_away_focus: bool = True) int

Waits until any Roblox window is in focus, and returns it’s window handle.

Note

Window handles are volatile. If you close an app and reopen it, it’s handle will likely have changed.

Parameters:

take_away_focus (bool) – If set to True, wait_for_focus will put the desktop window in focus after Roblox gets in focus. Defaults to True.

Returns:

The window handle for the Roblox window that made the function exit. A window handle is a unique integer that is used to identify a specific window.

Return type:

int

pyrobloxbot.wait(seconds: float) None

Suspend execution for a given number of seconds.

Important

You should use this method instead of time.sleep for manually adding delays in your bot.

This is because the failsafe will only work reliably if you use this method. Otherwise, hitting the failsafe hotkey while time.sleep is running will cause the failsafe to not be triggered.

Parameters:

seconds (float) – How long to wait for.