Main Lua Environment

Event System

The event system is how you run code. You must register callbacks to specific event names.

valex.register(event_name, callback)

Registers a function to be called by the internal event loop.

  • Parameters: event_name [string], callback [function]

  • Returns: void

Event Types:

  • "update": Runs every tick (approx 1ms). Use for logic/math.

  • "slow_update": Runs every second. Use for scanning instances.

  • "render": Runs every frame. Only draw here.

local function on_update()
    print("hey :)");
end

valex.register("update", on_update);
local function on_render()
    valex.draw_text("Hello", 100, 100, color3.white());
end

valex.register("render", on_render);

Engine

valex.get_game()

Returns the address of the DataModel.

  • Returns: uint64 (address)

valex.get_place_id()

Returns the current Place ID.

  • Returns: int64

valex.get_visual_engine()

Returns the address of the Visual Engine.

  • Returns: uint64 (address)

valex.get_dimensions()

Returns the width and height of the viewport.

  • Returns: float, float

valex.world_to_screen(world_position)

Converts a 3D world position to 2D screen coordinates.

  • Parameters: world_position [vector3]

  • Returns: bool (visible), vector3 (x, y, depth)


Instance

valex.get_name(instance)

Gets the Name property of an instance.

  • Parameters: instance [uint64]

  • Returns: string

valex.get_class_name(instance)

Gets the ClassName property of an instance.

  • Parameters: instance [uint64]

  • Returns: string

valex.get_children(instance)

Gets a list of child instances.

  • Parameters: instance [uint64]

  • Returns: table (array of uint64)

valex.get_parent(instance)

Gets the Parent of an instance.

  • Parameters: instance [uint64]

  • Returns: uint64 (address)

valex.find_first_child(instance, name)

Finds the first child with the specific name.

  • Parameters: instance [uint64], name [string]

  • Returns: uint64 (address)

valex.find_first_child_of_class(instance, class_name)

Finds the first child that matches the ClassName.

  • Parameters: instance [uint64], class_name [string]

  • Returns: uint64 (address)

valex.get_service(instance, class_name)

Alias for find_first_child_of_class, commonly used to get Services.

  • Parameters: instance [uint64], class_name [string]

  • Returns: uint64 (address)

valex.is_a(instance, class_name)

Checks if an instance inherits from a specific class.

  • Parameters: instance [uint64], class_name [string]

  • Returns: bool


Humanoid

valex.get_health(humanoid)

Gets the current health.

  • Parameters: humanoid [uint64]

  • Returns: float

valex.get_max_health(humanoid)

Gets the maximum health.

  • Parameters: humanoid [uint64]

  • Returns: float

valex.get_walk_speed(humanoid)

Gets the WalkSpeed.

  • Parameters: humanoid [uint64]

  • Returns: float

valex.get_jump_power(humanoid)

Gets the JumpPower.

  • Parameters: humanoid [uint64]

  • Returns: float

valex.set_walk_speed(humanoid, value)

Sets the WalkSpeed.

  • Parameters: humanoid [uint64], value [float]

  • Returns: void

valex.set_jump_power(humanoid, value)

Sets the JumpPower. Must be between 0 and 1000.

  • Parameters: humanoid [uint64], value [float]

  • Returns: void


Parts

valex.get_part_position(part)

Gets the world position of a part.

  • Parameters: part [uint64]

  • Returns: vector3

valex.get_part_size(part)

Gets the size of a part.

  • Parameters: part [uint64]

  • Returns: vector3

valex.get_part_velocity(part)

Gets the velocity of a part.

  • Parameters: part [uint64]

  • Returns: vector3


Player

valex.get_character(player)

Gets the character model of a player.

  • Parameters: player [uint64]

  • Returns: uint64 (address)

valex.get_team(player)

Gets the team of a player.

  • Parameters: player [uint64]

  • Returns: uint64 (address)

valex.get_client(players_service)

Gets the LocalPlayer from the Players service.

  • Parameters: players_service [uint64]

  • Returns: uint64 (address)


Camera

valex.get_camera()

Gets the current camera address.

  • Returns: uint64 (address)

valex.get_camera_position(camera)

Gets the absolute world position of the camera.

  • Parameters: camera [uint64]

  • Returns: vector3

valex.get_camera_fov(camera)

Gets the camera Field Of View.

  • Parameters: camera [uint64]

  • Returns: float

valex.set_camera_fov(camera, value)

Sets the camera Field Of View.

  • Parameters: camera [uint64], value [float]

  • Returns: void


Utility

valex.show_console(show)

Toggles the external debug console.

  • Parameters: show [bool]

  • Returns: void

valex.clear_console()

Clears the console output.

  • Returns: void

valex.get_finger_print()

Returns the user's unique SID.

  • Returns: string

valex.get_hwid()

Alias for get_finger_print().

  • Returns: string

valex.set_clipboard(text)

Copies text to the Windows clipboard.

  • Parameters: text [string]

  • Returns: void


Input

valex.mouse_click(button)

Simulates a mouse click. Buttons: 0 = Left, 1 = Right, 2 = Middle.

  • Parameters: button [int32]

  • Returns: void

valex.is_clicked(button)

Checks if a mouse button is physically held down. Buttons: 0 = Left, 1 = Right, 2 = Middle.

  • Parameters: button [int32]

  • Returns: bool

valex.mouse_scroll(delta)

Simulates a mouse wheel scroll.

  • Parameters: delta [int32]

  • Returns: void

valex.move_mouse(x, y)

Moves the mouse to absolute screen coordinates.

  • Parameters: x [int32], y [int32]

  • Returns: void

valex.press_key(key)

Simulates pressing a key down.

valex.release_key(key)

Simulates releasing a key.

valex.is_key_pressed(key)

Checks if a key is physically held down.


Files

valex.read_file(filepath)

Reads a file from the workspace folder.

  • Parameters: filepath [string]

  • Returns: string (or nil if failed)

valex.write_file(filepath, content)

Writes a file to the workspace folder.

  • Parameters: filepath [string], content [string]

  • Returns: bool


HTTP

valex.http_get(url, headers, callback)

Performs an asynchronous GET request.

  • Parameters: url [string], headers [table], callback [function]

  • Returns: void

valex.http_post(url, headers, body, callback)

Performs an asynchronous POST request.

  • Parameters: url [string], headers [table], body [string], callback [function]

  • Returns: void


Drawing (Render Callback Only)

These functions can only be used inside a render callback.

valex.draw_line(x1, y1, x2, y2, color, thickness, alpha)

Draws a line.

  • Parameters: x1, y1, x2, y2 [float], color [color3], thickness [float], alpha [optional float]

valex.draw_rect(x, y, w, h, color, thickness, alpha)

Draws an outlined rectangle.

  • Parameters: x, y, w, h [float], color [color3], thickness [optional float], alpha [optional float]

valex.draw_filled_rect(x, y, w, h, color, thickness, alpha)

Draws a filled rectangle.

  • Parameters: x, y, w, h [float], color [color3], thickness [optional float], alpha [optional float]

valex.draw_circle(x, y, radius, color, alpha, thickness)

Draws an outlined circle.

  • Parameters: x, y, radius [float], color [color3], alpha [optional float], thickness [optional float]

valex.draw_filled_circle(x, y, radius, color, alpha, thickness)

Draws a filled circle.

  • Parameters: x, y, radius [float], color [color3], alpha [optional float], thickness [optional float]

valex.draw_triangle(x1, y1, x2, y2, x3, y3, color, alpha)

Draws an outlined triangle.

  • Parameters: x1, y1, x2, y2, x3, y3 [float], color [color3], alpha [optional float]

valex.draw_filled_triangle(x1, y1, x2, y2, x3, y3, color, alpha)

Draws a filled triangle.

  • Parameters: x1, y1, x2, y2, x3, y3 [float], color [color3], alpha [optional float]

valex.draw_text(text, x, y, color, alpha)

Draws text on the screen.

  • Parameters: text [string], x, y [float], color [color3], alpha [optional float]

valex.get_text_size(text)

Calculates size of text string.

  • Parameters: text [string]

  • Returns: width [float], height [float]

Last updated