# Table of Contents - [Serotonin Lua Documentation | Serotonin Docs](#serotonin-lua-documentation-serotonin-docs) - [What is this? | Serotonin Docs](#what-is-this-serotonin-docs) - [API | Serotonin Docs](#api-serotonin-docs) - [Setting Up | Serotonin Docs](#setting-up-serotonin-docs) - [FFlags | Serotonin Docs](#fflags-serotonin-docs) - [draw | Serotonin Docs](#draw-serotonin-docs) - [Core Concepts | Serotonin Docs](#core-concepts-serotonin-docs) - [input | Serotonin Docs](#input-serotonin-docs) - [Attributes | Serotonin Docs](#attributes-serotonin-docs) - [ Creating a Simple ESP | Serotonin Docs](#-creating-a-simple-esp-serotonin-docs) - [Properties | Serotonin Docs](#properties-serotonin-docs) - [entity | Serotonin Docs](#entity-serotonin-docs) - [Parts | Serotonin Docs](#parts-serotonin-docs) - [game | Serotonin Docs](#game-serotonin-docs) - [ui | Serotonin Docs](#ui-serotonin-docs) - [Model | Serotonin Docs](#model-serotonin-docs) - [Color3 | Serotonin Docs](#color3-serotonin-docs) - [cheat | Serotonin Docs](#cheat-serotonin-docs) - [Functions | Serotonin Docs](#functions-serotonin-docs) - [Vector3 & Color3 Example | Serotonin Docs](#vector3-color3-example-serotonin-docs) - [http | Serotonin Docs](#http-serotonin-docs) - [Vector3 | Serotonin Docs](#vector3-serotonin-docs) - [Methods | Serotonin Docs](#methods-serotonin-docs) - [file | Serotonin Docs](#file-serotonin-docs) - [utility | Serotonin Docs](#utility-serotonin-docs) - [audio | Serotonin Docs](#audio-serotonin-docs) - [Players | Serotonin Docs](#players-serotonin-docs) - [memory | Serotonin Docs](#memory-serotonin-docs) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [What is this? | Serotonin Docs](#what-is-this-serotonin-docs) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Unknown](#unknown) - [Setting Up | Serotonin Docs](#setting-up-serotonin-docs) - [Unknown](#unknown) --- # Serotonin Lua Documentation | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/serotonin-lua-documentation.md) . [](https://serotonin-1.gitbook.io/serotonin-docs#overview) Overview ------------------------------------------------------------------------ > The Serotonin Scripting API provides a high-performance, object-oriented environment for creating custom game modifications. You can manipulate game objects, draw custom overlays, and automate actions with a clean and modern Lua API. > > Our API is designed to be powerful and intuitive. Instead of low-level memory manipulation, you interact with clearly defined objects, properties, and methods that will feel familiar to anyone with experience on the Roblox platform. > > From a simple ESP to complex aiming mechanics, the API provides the tools you need. [NextWhat is this?](https://serotonin-1.gitbook.io/serotonin-docs/overview/what-is-this) Last updated 1 year ago --- # What is this? | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/overview/what-is-this.md) . The Serotonin scripting engine allows you to write `.lua` files to modify your game experience. It's built on LuaJIT for maximum performance and uses a modern C++ wrapper to expose a safe and easy-to-use API. * * * * **Performance:** Scripts run in a high-performance Just-In-Time compiled environment. * **Security:** The API is designed to be safe, with restricted access to the filesystem and network by default. * **Ease of Use:** A clean, object-oriented API with clear naming conventions lets you focus on logic instead of boilerplate. [PreviousSerotonin Lua Documentation](https://serotonin-1.gitbook.io/serotonin-docs) [NextCore Concepts](https://serotonin-1.gitbook.io/serotonin-docs/overview/core-concepts) Last updated 1 year ago --- # API | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api.md) . [game](https://serotonin-1.gitbook.io/serotonin-docs/api/game) [entity](https://serotonin-1.gitbook.io/serotonin-docs/api/entity) [draw](https://serotonin-1.gitbook.io/serotonin-docs/api/draw) [utility](https://serotonin-1.gitbook.io/serotonin-docs/api/utility) [cheat](https://serotonin-1.gitbook.io/serotonin-docs/api/cheat) [Previous Creating a Simple ESP](https://serotonin-1.gitbook.io/serotonin-docs/product-guides/creating-a-simple-esp) [Nextgame](https://serotonin-1.gitbook.io/serotonin-docs/api/game) Last updated 1 year ago --- # Setting Up | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/product-guides/setting-up.md) . 🛠️ Setting Up Your First Script 1\. Create a Lua File Create a new text file and save it with a `.lua` extension (e.g., `my-first-script.lua`). #### [](https://serotonin-1.gitbook.io/serotonin-docs/product-guides/setting-up#id-2.-place-it-in-the-scripts-folder) 2\. Place it in the Scripts Folder Find the Serotonin data folder on your computer and place your new `.lua` file inside the `scripts` subdirectory. You can use the "Open Scripts Folder" button in the menu's Scripting tab to get there quickly. #### [](https://serotonin-1.gitbook.io/serotonin-docs/product-guides/setting-up#id-3.-write-your-code) 3\. Write Your Code Open the file in a text editor (like VS Code, Notepad++, or Sublime Text) and write your script. A simple "Hello, World!" script looks like this: * * * Copy print("Hello from my first script!") -- Draw a green square on the screen local function draw_square() draw.rect(500, 500, 50, 50, 0, 255, 0, 255) end -- Register our drawing function to the onPaint event cheat.register("onPaint", draw_square) * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/product-guides/setting-up#id-4.-load-the-script) 4\. Load the Script In the Serotonin menu, navigate to the **Scripting** tab. Your new script should appear in the list. 1. Click on your script's name in the listbox. 2. Click the **"Load"** button. You should now see the message in the console and a green square on your screen! [PreviousCore Concepts](https://serotonin-1.gitbook.io/serotonin-docs/overview/core-concepts) [Next Creating a Simple ESP](https://serotonin-1.gitbook.io/serotonin-docs/product-guides/creating-a-simple-esp) Last updated 1 year ago --- # FFlags | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/game/fflags.md) . * * * **game.GetFFlag(name, type)** Retrieves the value of a given FFlag, casting it to the specified type. * **Parameters:** * name: string - The case-sensitive name of the FFlag. * type: string - The expected data type of the FFlag. Must be one of "bool", "int", "float", or "double". * **Returns:** * any | nil: The value of the FFlag cast to the specified type, or nil if the flag is not found. Copy local physics_steps = game.GetFFlag("PhysicsStepsPerSecond", "float") if physics_steps ~= nil then print("Physics steps per second:", physics_steps) end -- Example of a non-existent flag local not_found = game.GetFFlag("ThisFlagDoesNotExist", "int") if not_found == nil then print("Correctly reported that the FFlag was not found.") end * * * **game.SetFFlag(name, value, type)** Sets the value of a given FFlag, writing it as the specified type. * **Parameters:** * name: string - The case-sensitive name of the FFlag. * value: any - The new value for the FFlag. * type: string - The data type to write the value as. Must be one of "bool", "int", "float", or "double". * **Returns:** * boolean: true if the FFlag was found and the value was written successfully, false otherwise. Copy -- Enable a boolean FFlag local success = game.SetFFlag("DebugDrawBroadPhaseAABBs", true, "bool") if success then print("Enabled broad phase debug drawing.") end -- Set the physics framerate game.SetFFlag("PhysicsStepsPerSecond", 240.0, "float") -- Set an integer value game.SetFFlag("SomeIntegerValue", 100, "int") [PreviousAttributes](https://serotonin-1.gitbook.io/serotonin-docs/api/game/attributes) [Nextentity](https://serotonin-1.gitbook.io/serotonin-docs/api/entity) Last updated 9 months ago --- # draw | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/draw.md) . **IMPORTANT:** All `draw`functions must be called from within a function registered to the `onPaint` callback. All color parameters are integers ranging from **0 to 255**. **This script will draw a Polyline tracing the local player's Head.** Copy local TARGET_BONE_NAME = "Head" local OUTLINE_COLOR = Color3.new(0, 1, 1) local OUTLINE_THICKNESS = 2.0 local OUTLINE_ALPHA = 255 local function on_paint() local local_player = entity.get_local_player() if not local_player then return end local head = local_player:get_bone_instance(TARGET_BONE_NAME) if not head then return end local world_points = draw.get_part_corners(head) if not world_points then return end local screen_points = {} for i, world_pos in ipairs(world_points) do local screen_x, screen_y, is_on_screen = utility.world_to_screen(world_pos) if is_on_screen then table.insert(screen_points, { screen_x, screen_y }) end end if #screen_points < 3 then return end local hull_points = draw.compute_convex_hull(screen_points) if not hull_points or #hull_points < 2 then return end draw.polyline(hull_points, OUTLINE_COLOR, true, OUTLINE_THICKNESS, OUTLINE_ALPHA) end cheat.register("onPaint", on_paint) #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/draw#draw.line-x1-y1-x2-y2-color-thickness-alpha) draw.Line(x1, y1, x2, y2, color, \[thickness\], \[alpha\]) Draws a line between two points. **Parameters:** * `x1, y1: number` - Start coordinates. * `x2, y2: number` - End coordinates. * `color` - Color3 object. * `alpha: number` - (optional, default = 255) - the alpa transparency of the color. * `thickness: number` - The thickness of the line in pixels. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/draw#draw.rect-x-y-w-h-color-thickness-rounding-alpha) draw.Rect(x, y, w, h, color, \[thickness\], \[rounding\], \[alpha\]) Draws the outline of a rectangle. * **Parameters:** * x, y: number - Top-left corner coordinates. * w, h: number - Width and height. * color: Color3 - The color of the outline. * alpha: number (optional, default=255) - The alpha transparency of the color. * thickness: number (optional, default=1.0) - The thickness of the outline. * rounding: number (optional, default=0.0) - The radius of the corner rounding. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/draw#draw.rectfilled-x-y-w-h-color-rounding-alpha) draw.RectFilled(x, y, w, h, color, \[rounding\], \[alpha\]) Draws a filled rectangle. * **Parameters:** * x, y: number - Top-left corner coordinates. * w, h: number - Width and height. * color: Color3 - The fill color. * alpha: number (optional, default=255) - The alpha transparency of the color. * rounding: number (optional, default=0.0) - The radius of the corner rounding. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/draw#draw.circle-x-y-radius-color-thickness-segments-alpha) draw.Circle(x, y, radius, color, \[thickness\], \[segments\], \[alpha\]) Draws the outline of a circle. * **Parameters:** * x, y: number - Center coordinates. * radius: number - The radius of the circle. * color: Color3 - The color of the outline. * alpha: number (optional, default=255) - The alpha transparency of the color. * thickness: number (optional, default=1.0) - The thickness of the outline. * segments: integer (optional, default=12) - The number of segments to use. More segments result in a smoother circle. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/draw#draw.circlefilled-x-y-radius-color-segments-alpha) draw.CircleFilled(x, y, radius, color, \[segments\], \[alpha\]) Draws a filled circle. * **Parameters:** * x, y: number - Center coordinates. * radius: number - The radius of the circle. * color: Color3 - The fill color. * alpha: number (optional, default=255) - The alpha transparency of the color. * segments: integer (optional, default=12) - The number of segments to use. More segments result in a smoother circle. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/draw#draw.triangle-x1-y1-x2-y2-x3-y3-color-thickness-alpha) draw.Triangle(x1, y1, x2, y2, x3, y3, color, \[thickness\], \[alpha\]) Draws the outline of a triangle defined by three points. * **Parameters:** * x1, y1: number - Coordinates of the first point. * x2, y2: number - Coordinates of the second point. * x3, y3: number - Coordinates of the third point. * color: Color3 - The color of the outline. * alpha: number (optional, default=255) - The alpha transparency of the color. * thickness: number (optional, default=1.0) - The thickness of the outline. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/draw#draw.trianglefilled-x1-y1-x2-y2-x3-y3-color-alpha) draw.TriangleFilled(x1, y1, x2, y2, x3, y3, color, \[alpha\]) Draws a filled triangle defined by three points. * **Parameters:** * x1, y1: number - Coordinates of the first point. * x2, y2: number - Coordinates of the second point. * x3, y3: number - Coordinates of the third point. * color: Color3 - The fill color. * alpha: number (optional, default=255) - The alpha transparency of the color. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/draw#draw.gradient-x-y-w-h-startcolor-endcolor-ishorizontal-startalpha-endalpha) draw.Gradient(x, y, w, h, startColor, endColor, isHorizontal, \[startAlpha\], \[endAlpha\]) Draws a rectangle with a two-color gradient. * **Parameters:** * x, y, w, h: number - The position and size. * startColor, endColor: Color3 - The gradient colors. * isHorizontal: boolean - true for left-to-right, false for top-to-bottom. * startAlpha: number (optional, default=255) - Alpha for startColor. * endAlpha: number (optional, default=255) - Alpha for endColor. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/draw#draw.image-textureid-x-y-w-h-r-g-b-a) draw.Image(textureId, x, y, w, h, r, g, b, a) Draws a filled triangle defined by three points. * **Parameters:** * textureId: integer - The ID from utility.loadImage. * x, y, w, h: number - The position and size. * r, g, b, a: integer - The tint color (0-255). * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/draw#draw.text-text-x-y-color-font-alpha) draw.Text(text, x, y, color, \[font\], \[alpha\]) Draws text on the screen using a specified font. * **Parameters:** * `text`: `string` - The text to draw. * `x`, `y`: `number` - Top-left coordinates for the text. * `color`: `Color3` - The color of the text. * `font`: `string` (optional) - The name of the font to use. If omitted, the default font will be used. Available fonts: * `"ConsolasBold"` * `"SmallestPixel"` * `"Verdana"` * `"Tahoma"` * `alpha`: `number` (optional, default=255) - The alpha transparency of the color. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/draw#draw.textoutlined-text-x-y-color-font-alpha) draw.TextOutlined(text, x, y, color, \[font\],\[alpha\]) Draws text with a standard black outline for high contrast and better readability. * **Parameters:** * text: string - The text to draw. * x, y: number - Top-left coordinates for the text. * color: Color3 - The color of the text. * font: string (optional) - The name of the font to use. If omitted, the default font will be used. Available fonts: * "ConsolasBold" * "SmallestPixel" * "Verdana" * "Tahoma" * alpha: number (optional, default=255) - The alpha transparency of the color. Copy local white = Color3.new(1, 1, 1) -- Draw with the default font draw.TextOutlined("PlayerName [100m]", 150, 200, white) draw.TextOutlined("Objective", 150, 220, white, "Verdana", 150) * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/draw#draw.gettextsize-text-font) draw.GetTextSize(text, \[font\]) Calculates the width and height of a string, without actually drawing it. This is useful for positioning elements. * **Parameters:** * text: string - The text to measure. * font: string (optional) - The name of the font to use. If omitted, the default font will be used. Available fonts: * "ConsolasBold" * "SmallestPixel" * "Verdana" * "Tahoma" * **Returns:** * width: number * height: number * Example: Copy local my_text = "Hello, World!" local text_width, text_height = draw.get_text_size(my_text) print("Text is " .. text_width .. " pixels wide and " .. text_height .. " pixels high.") * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/draw#draw.computeconvexhull-points) draw.ComputeConvexHull(points) Takes a set of 2D points and returns the smallest possible convex polygon that encloses all of them. This is extremely useful for drawing an outline around multiple, potentially overlapping shapes to create a single, clean silhouette. * **Parameters:** * points: table - An array-like table of points to process (e.g., { {x1, y1}, {x2, y2}, ... }). * **Returns:** * hull\_points: table - A new table of points representing the vertices of the convex hull, ready to be used with draw.Polyline or draw.ConvexPolyFilled. Copy local all_points = { {100, 100}, {200, 100}, {250, 150}, {250, 250}, {150, 250}, {100, 200} } local silhouette = draw.compute_convex_hull(all_points) draw.convex_poly_filled(silhouette, Color3.new(1, 0, 0), 128) local white_color = Color3.new(1, 1, 1) draw.Polyline(silhouette, white_color, true, 2.0) -- no alpha passed, defaults to 255 * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/draw#draw.polyline-points-color-closed-thickness-alpha) draw.Polyline(points, color, closed, thickness, \[alpha\]) Draws a series of connected lines through a set of points. * **Parameters:** * points: table - An array of points, e.g., { {x1, y1}, {x2, y2}, ... }. * color: Color3 - The color of the lines. * closed: boolean - If true, connects the last point to the first. * thickness: number - The thickness of the lines in pixels. * alpha: number (optional, default=255) - The alpha transparency. Copy local star_points = { {100, 20}, {110, 60}, {150, 60}, {120, 85}, {130, 125}, {100, 100}, {70, 125}, {80, 85}, {50, 60}, {90, 60} } -- draw an open red star shape (alpha will default to 255) draw.Polyline(star_points, Color3.new(1, 0, 0), false, 2.0) for i, p in ipairs(star_points) do p[1] = p[1] + 150 end draw.Polyline(star_points, Color3.new(0, 0, 1), true, 2.0, 128) * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/draw#draw.convexpolyfilled-points-color-alpha) draw.ConvexPolyFilled(points, color, \[alpha\]) Draws a filled, convex polygon. A convex polygon has no "inward-pointing" corners. * **Parameters:** * points: table - An ordered array of vertices. * color: Color3 - The fill color. * alpha: number (optional, default=255) - The alpha transparency. Copy local hexagon_points = { {200, 200}, {250, 200}, {275, 243}, {250, 286}, {200, 286}, {175, 243} } local green = Color3.new(0, 255, 0) draw.ConvexPolyFilled(hexagon_points, green, 128) * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/draw#draw.getpartcorners-part) draw.GetPartCorners(part) Calculates the 8 world-space corners of a part's bounding box, accounting for its position, size, and rotation. This is the recommended way to get points for drawing an outline around a part. * **Parameters:** * part: Instance - The Part object to process. * **Returns:** * corners\_table: table - A table containing 8 Vector3 objects representing each corner, or nil if the part is invalid. Copy local head = entity.GetLocalPlayer():GetBoneInstance("Head") if head then local corners_3d = draw.GetPartCorners(head) if corners_3d then -- Now you can loop through 'corners_3d' and use utility.worldToScreen on each one -- to get the 2D points needed for drawing. end end * * * [PreviousModel](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/model) [Nextaudio](https://serotonin-1.gitbook.io/serotonin-docs/api/audio) Last updated 11 months ago --- # Core Concepts | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/overview/core-concepts.md) . **Event-Driven Callbacks** The scripting engine is event-driven. Instead of running your script in an infinite loop, you register functions to be called when specific events occur. This is more efficient and integrates cleanly with the application's lifecycle. * * * You register a function using `cheat.register()`. Callback Name Frequency Description onUpdate ~5ms For logic that needs to run many times per second, like target finding or physics calculations. onSlowUpdate ~1s For non-critical background tasks, like checking a value periodically or logging stats. onPaint Every Frame **(Most Common)** All drawing must be done here. Use the drawlibrary to draw to the screen. * * * Copy local function my_paint_function() draw.rect(10, 10, 100, 100, 255, 0, 0, 255) end -- Register the function to be called by the engine cheat.reigster("onPaint", my_paint_function) [PreviousWhat is this?](https://serotonin-1.gitbook.io/serotonin-docs/overview/what-is-this) [NextSetting Up](https://serotonin-1.gitbook.io/serotonin-docs/product-guides/setting-up) Last updated 11 months ago --- # input | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/input.md) . **Mouse** The mouse library provides functions to simulate mouse actions and check the state of mouse buttons. #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/input#important-notes) 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. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/input#click) 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:** Copy -- In a callback or loop, this would simulate clicking the left mouse button. mouse.click("leftmouse") #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/input#isclicked) 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:** Copy 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) #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/input#scroll) 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:** Copy -- 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. #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/input#important-notes-1) 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. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/input#press) 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:** Copy -- Make the character walk forward by holding the 'W' key. keyboard.press("w") #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/input#release) 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:** Copy -- Stop walking forward. keyboard.release("w") #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/input#click-1) Click Simulates a complete key press-and-release action, often called a 'keypress' or 'click'. It sends a 'key down' event, waits for a specified duration, and then sends a 'key up' event. This is perfect for single actions like typing a character or activating an ability. * **Aliases:** keyboard.Click, keyboard.click * **Signature:** keyboard.Click(key, \[delay\]) * **Parameters:** * key: string|integer - The key to click. * delay: integer (optional) - The duration to hold the key in milliseconds. Defaults to a brief, human-like delay (e.g., 50ms) if omitted. Copy -- Quickly tap the 'E' key keyboard.click("e") -- Send a message in chat by clicking 'enter' with a longer delay (100 ms). keyboard.click("enter", 100) #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/input#ispressed) 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:** Copy 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) [Previousutility](https://serotonin-1.gitbook.io/serotonin-docs/api/utility) [Nextui](https://serotonin-1.gitbook.io/serotonin-docs/api/ui) Last updated 11 months ago --- # Attributes | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/game/attributes.md) . * * * The core functions return an **Attribute Table**, which is a standard Lua table with the following structure: * .Name (string): The name of the attribute. * .TypeName (string): The data type of the attribute (e.g., "string", "CoordinateFrame", "Rect2D"). * .Value: The attribute's value. The format of this value depends on its TypeName. * * * **:GetAttributes()** Retrieves a table containing all attributes attached to the Instance. This is the most efficient way to inspect every attribute on an object at once. The function returns an array-like table where each element is another table representing a single attribute. Each attribute table contains three key-value pairs: * .Name (string): The name of the attribute. * .TypeName (string): The type of the attribute (e.g., "string", "Color3", "number"). * .Value: The actual value of the attribute, with a data type matching its TypeName. **Returns** * (table) An array of attribute tables. **Example: Inspecting All Attributes** This example iterates through all attributes on a Part named "TestPart" and prints their details. Copy local testPart = game.Workspace.TestPart local allAttributes = testPart:GetAttributes() print("Attributes for: " .. testPart.Name) for _, attr in ipairs(allAttributes) do -- attr is a table like { Name = "TestName", TypeName = "string", Value = "TestValue" } print(string.format(" -> Name: %s, Type: %s", attr.Name, attr.TypeName)) end **Expected Output:** Copy Attributes for: TestPart -> Name: MyString, Type: string -> Name: MyColor, Type: Color3 -> Name: IsActive, Type: boolean ### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/attributes#getattribute-string-name) **:GetAttribute(string: name)** Finds and returns a single attribute by its exact name. This is the simplest way to get the value of a specific, known attribute. **Parameters** * name (string): The case-sensitive name of the attribute to find. **Returns** * (table) An attribute table with .Name, .TypeName, and .Value fields if found. * nil if no attribute with the specified name exists on the Instance. **Example: Retrieving a Specific Attribute** This example looks for an attribute named "SpecialID" and prints its value. Copy local testPart = game.Workspace.TestPart local idAttribute = testPart:GetAttribute("SpecialID") if idAttribute then -- The attribute was found, we can safely access its value print("Found attribute 'SpecialID'.") print(" - Type: " .. idAttribute.TypeName) print(" - Value: " .. tostring(idAttribute.Value)) else print("Attribute 'SpecialID' was not found on the part.") end * * * ### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/attributes#getfirstattributeoftype-string-typename) **:GetFirstAttributeOfType(string: TypeName)** Finds and returns the first attribute that matches the given type name. This is useful when you need to find data of a certain kind but don't care about its specific name. **Parameters** * typeName (string): The case-sensitive type of the attribute to find (e.g., "Color3", "Vector3", "string"). **Returns** * (table) The first attribute table found that matches the type. * nil if no attributes of the specified type exist on the Instance. **Example: Finding a Color Attribute** This example finds the first Color3 attribute on a part, regardless of its name, and applies that color to the part itself. Copy local testPart = game.Workspace.TestPart local colorAttribute = testPart:GetFirstAttributeOfType("Color3") if colorAttribute then print(string.format("Found a Color3 attribute named '%s'.", colorAttribute.Name)) -- The value is a Color3 object, which can be assigned directly testPart.Color = colorAttribute.Value print("Applied the attribute's color to the part.") else print("No Color3 attributes were found on this part.") end * * * ### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/attributes#attribute-data-types) **Attribute Data Types** The .Value field of a returned Attribute Table can be one of several types. Here’s how to access the data for each TypeName. #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/attributes#primitive-types) **Primitive Types** These are returned as standard Lua types. TypeName Lua Type Description string string A standard string of text. double number A floating-point number. Also used for Number. bool boolean A true or false value. BrickColor integer The numerical ID of a BrickColor. **Example** Copy local strAttr = part:GetAttribute("MyString") print(strAttr.Value) -- prints the string directly local numAttr = part:GetAttribute("MyNumber") print(numAttr.Value * 2) -- Can be used in math #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/attributes#object-types) **Object Types** These are returned as custom userdata objects or tables. * **Color3** The .Value is a Color3 object. You can access its components with .R, .G, and .B. Copy local colorAttr = part:GetFirstAttributeOfType("Color3") if colorAttr then -- The value is a Color3 object local r, g, b = colorAttr.Value.R, colorAttr.Value.G, colorAttr.Value.B print(string.format("Color: R=%.2f, G=%.2f, B=%.2f", r, g, b)) end * **Vector3** The .Value is a Vector3 object with .X, .Y, and .Z components. Copy local vectorAttr = part:GetAttribute("MyVector") if vectorAttr then local pos = vectorAttr.Value print("Position: " .. pos.X .. ", " .. pos.Y .. ", " .. pos.Z) end * **Vector2** The .Value is a Lua table with .X and .Y number fields. Copy local vector2Attr = part:GetAttribute("MyVector2") if vector2Attr then print(string.format("Vector2 Value: X=%d, Y=%d", vector2Attr.Value.X, vector2Attr.Value.Y)) end * **CoordinateFrame** The .Value is a Lua table containing the CFrame's components, each being a Vector3 object. Copy local cfAttr = part:GetFirstAttributeOfType("CoordinateFrame") if cfAttr then local cfValue = cfAttr.Value print("CFrame Position: " .. tostring(cfValue.Position)) print("CFrame LookVector: " .. tostring(cfValue.LookVector)) end * **Rect2D** The .Value is a Lua table containing .Min and .Max fields, both of which are tables representing a 2D vector ({X, Y}). Copy local rectAttr = part:GetFirstAttributeOfType("Rect2D") if rectAttr then local rect = rectAttr.Value print(string.format("Rect: Min(%d, %d), Max(%d, %d)", rect.Min.X, rect.Min.Y, rect.Max.X, rect.Max.Y)) end * **UDim** The .Value is a Lua table with a .Scale (number) and .Offset (integer) field. Copy local udimAttr = part:GetFirstAttributeOfType("UDim") if udimAttr then local udim = udimAttr.Value print(string.format("UDim: Scale=%.2f, Offset=%d", udim.Scale, udim.Offset)) end [PreviousProperties](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties) [NextFFlags](https://serotonin-1.gitbook.io/serotonin-docs/api/game/fflags) Last updated 12 months ago --- # Creating a Simple ESP | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/product-guides/creating-a-simple-esp.md) . An ESP script is a great way to learn the fundamentals of the API. This guide will show you how to draw a box around every enemy player. * * * This script uses three key components: 1. `entity.GetPlayers()`: To get a list of all players. 2. `entity.IsEnemy()` and `entity.BoundingBox()`: To check if a player is an enemy and get their screen position. 3. `draw.Rect()`: To draw the box. * * * Copy local function draw_esp() -- Get a list of all enemy player objects local enemy_players = entity.GetPlayers(true) for _, player in ipairs(enemy_players) do if player.IsAlive then -- Get the 2D bounding box from the player object's property local bbox = player.BoundingBox draw.Rect(bbox.x, bbox.y, bbox.w, bbox.h, Color3.fromRGB(255, 0, 0)) local name = player.Name local teamColor = player.TeamColor -- This is a Color3 object -- Calculate text size to center it local text_width, text_height = draw.GetTextSize(name, "Tahoma") local text_x = bbox.x + (bbox.w / 2) - (text_width / 2) local text_y = bbox.y - text_height - 2 -- Position text above the box draw.text(name, text_x, text_y, Color3.fromRGB(teamColor.R, teamColor.G, teamColor.B), "Tahoma", 255) -- Draw a health bar local health_percent = player.Health / player.MaxHealth local bar_width = 5 local bar_height = bbox.h * health_percent local bar_x = bbox.x - bar_width - 2 local bar_y = bbox.y + (bbox.h - bar_height) draw.Rect(bar_x, bbox.y, bar_width, bbox.h, Color3.fromRGB(50, 0, 0)) draw.RectFilled(bar_x, bar_y, bar_width, bar_height, Color3.fromRGB(0, 255, 0)) end end end -- Register our function to the onPaint event cheat.register("onPaint", draw_esp) [PreviousSetting Up](https://serotonin-1.gitbook.io/serotonin-docs/product-guides/setting-up) [NextAPI](https://serotonin-1.gitbook.io/serotonin-docs/api) Last updated 10 months ago --- # Properties | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties.md) . #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model) .Parent The direct parent of the object in the hierarchy. Setting this property to a new `Instance` will move the object. Setting it to `nil` will remove it from the game world. Copy local part = game.Workspace.MyPart print("The parent of MyPart is", part.Parent.Name) -- "Workspace" -- Move the part to be a child of the character part.Parent = game.LocalPlayer.Character * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-1) .Name The name of the object. Copy local part = game.Workspace:FindFirstChild("Baseplate") print(part.Name) -- "Baseplate" part.Name = "NewBaseplate" * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-2) .Character The character model currently controlled by the `Player`. This model contains the `Humanoid` and all body parts. This can be `nil` if the player has not spawned yet or their character has been destroyed. Copy local character = game.LocalPlayer.Character if character then -- Character exists, find the Humanoid local humanoid = character:FindFirstChildOfClass("Humanoid") if humanoid then print("My health is:", humanoid.Health) end end * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-3) .ClassName The specific class type of the object (e.g., "Part", "Humanoid", "Player"). Copy for _, child in ipairs(game.Workspace:GetChildren()) do print(child.Name, "is a", child.ClassName) end * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-4) .Address The memory address of the object instance, represented as a hexadecimal string. Useful for a unique identifier. Copy print("Workspace address:", game.Workspace.Address) * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-5) .Color The RGB color of the Part, represented as a Color3 object. Copy local myPart = game.GetWorkspace().MyPart -- Set the color to blue myPart.Color = Color3.new(0, 0, 255) -- Read the color back and check its components local currentColor = myPart.Color print("The red component is: " .. currentColor.R) * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-6) .Material The name of the physical material of the object (e.g., "Plastic", "Metal", "Neon"). Copy game.Workspace.MyPart.Material = "Neon" * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-7) .Size The size of the Part's bounding box along its local X, Y, and Z axes, represented as a Vector3. Copy local myPart = game.GetWorkspace().MyPart myPart.Size = Vector3.new(10, 10, 10) -- Read the size back local currentSize = myPart.Size print("The part's width (X size) is: " .. currentSize.X) * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-8) .Value A generic property for getting or setting the value of "**Value Objects" like StringValue, NumberValue, ObjectValue**, etc. The type returned or accepted depends on the object's **ClassName**. Copy local myStringValue = game.Workspace.MyStringValue print(myStringValue.Value) myStringValue.Value = "New Value" local myObjectValue = game.Workspace.MyObjectValue myObjectValue.Value = game.LocalPlayer.Character -- Set it to an Instance * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-9) .SoundId The asset ID of the sound associated with this object, if any. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-10) .Position The 3D world coordinate of the Part's center, represented as a Vector3 object. Copy local myPart = game.GetWorkspace().MyPart -- Get the position as a single Vector3 object local currentPos = myPart.Position print("The part's height (Y position) is: " .. currentPos.Y) -- To set the position, you must create a new Vector3 myPart.Position = Vector3.new(currentPos.X, currentPos.Y + 10, currentPos.Z) * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-11) .Velocity The speed and direction the Part is moving, represented as a Vector3 in studs per second. Copy local myPart = game.GetWorkspace().MyPart -- Make the part move upwards by setting its velocity with a Vector3 myPart.Velocity = Vector3.new(0, 100, 0) -- Read the velocity back local currentVelocity = myPart.Velocity print("Current upward speed is: " .. currentVelocity.Y) * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-12) .CanCollide Returns a bool value of whether the BasePart has CanCollide enabled or not. Can be used to set Collide. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-13) .Transparency The transparency of the Part. A value of 0 is completely opaque, and 1 is completely invisible. Copy -- Make the part semi-transparent game.Workspace.MyPart.Transparency = 0.5 * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-14) .Reflectance How much the Part reflects its surroundings. A value of 0 is non-reflective (like matte plastic), and 1 is perfectly reflective (like a mirror). Copy game.Workspace.MyPart.Reflectance = 1 * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-15) .Rotation The orientation of the Part, represented as a Vector3. This property is **read-only**. Copy local myPart = game.GetWorkspace().MyPart -- Get the rotation as a single Vector3 object local currentRotation = myPart.Rotation print(string.format("Current Y-axis rotation: %.2f", currentRotation.Y)) * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-16) .LookVector A unit vector (length of 1) that points in the direction of the Part's **front** (-Z) face. It's a Vector3 Object. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-17) .RightVector A unit vector (length of 1) that points in the direction of the Part's **right** (+X) face. It's a Vector3 Object. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-18) .UpVector A unit vector (length of 1) that points in the direction of the Part's **top** (+Y) face. It's a Vector3 Object. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-19) .MeshId The asset ID for a custom mesh. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-20) .TextureId The asset ID for a texture applied to the Part. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-21) .DecalTextureId The asset ID for a decal applied to the Part. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-22) .SpecialMeshTextureId The asset ID for the texture of a SpecialMesh object inside the Part. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-23) .BonePosition The 3D position of a bone object. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-24) .ButtonPosition The 2D position of a button object. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-25) .ButtonSize The size of a button object. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-26) .VisibleFrame A property related to whether the frame is visible or not * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-27) .HoldDuration The time in seconds a user must hold an interaction, typically for a ProximityPrompt. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-28) .MaxActivationDistance The maximum distance in studs from which a user can interact with this Part, typically for a ProximityPrompt. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-29) .ProximityActionText The text displayed to the user when they are able to interact with this Part (e.g., "Open", "Talk"). * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-30) .ProximityExclusivity The exclusivity behavior of the ProximityPrompt (e.g., "OnePerButton"). * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-31) .UserId The unique numerical ID associated with the player's account. Copy print("My UserID is:", game.LocalPlayer.UserId) * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-32) .Team The name of the Team the Player is currently on. Copy if game.LocalPlayer.Team == "Red" then print("I'm on the Red team!") end * * * **.FramePosition** A read-only property that returns the X and Y coordinates of a GUI element's position. * * * **.FrameBackgroundColor** A read-only Color3 property that describes the background color of a GUI Frame. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-33) .**FrameBorderColor** A read-only Color3 property that describes the border color of a GUI Frame. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-34) .CameraMaxZoomDistance The maximum distance in studs the player can zoom their camera out. Copy -- Allow the player to zoom out very far game.LocalPlayer.CameraMaxZoomDistance = 1000 * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-35) Humanoid Copy local my_humanoid = game.LocalPlayer.Character.Humanoid local health_percentage = (my_humanoid.Health / my_humanoid.MaxHealth) * 100 print(string.format("I am at %.2f%% health.", health_percentage)) * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-36) .MaxHealth The maximum health of the Humanoid. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-37) .MoveDirection A unit vector representing the direction the Humanoid is currently moving, relative to the world. A vector of (0, 0, 0) means the Humanoid is standing still. Copy local move_dir_x, move_dir_y, move_dir_z = game.LocalPlayer.Character.Humanoid.MoveDirection if move_dir_z < -0.5 then print("I am moving forward!") end * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties#data-model-38) .Health The health of the Humanoid. * * * [PreviousMethods](https://serotonin-1.gitbook.io/serotonin-docs/api/game/methods) [NextAttributes](https://serotonin-1.gitbook.io/serotonin-docs/api/game/attributes) Last updated 10 months ago --- # entity | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/entity.md) . Unlike the `game` global which interacts with live game objects, the `entity` library works with a snapshot of data that is updated by the client at optimized intervals. * * * [PreviousFFlags](https://serotonin-1.gitbook.io/serotonin-docs/api/game/fflags) [NextPlayers](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players) Last updated 1 year ago --- # Parts | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/parts.md) . These functions operate on an integer `index` which you get from `entity.GetParts()`. #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/parts#data-model) GetParts() Returns a table of integer indices for all currently cached parts. * table of number indices. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/parts#data-model-1) getPartPosition(int: index) **Returns:** number, number, number - The X, Y, and Z world coordinates. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/parts#getpartsize-int-index) getPartSize(int: index) **Returns:** number, number, number - The X, Y, and Z size. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/parts#getpartrotation-int-index) getPartRotation(int: index) Returns the part's rotation matrix as a flat table of 9 numbers. * * * [PreviousPlayers](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players) [NextModel](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/model) Last updated 1 year ago --- # game | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/game.md) . #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game#data-model) Workspace Copy game.Workspace Returns the Workspace instance. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game#data-model-1) Players Copy game.Players Returns the Players instance. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game#data-model-2) DataModel Copy game.DataModel Returns the DataModel instance. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game#data-model-3) LocalPlayer Copy game.LocalPlayer Returns the LocalPlayer instance. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game#data-model-4) PlaceID Copy if game.PlaceID == 12345678 then print("We are in the special testing place!") end The unique numerical ID of the current game or "place" you are in. [PreviousAPI](https://serotonin-1.gitbook.io/serotonin-docs/api) [NextFunctions](https://serotonin-1.gitbook.io/serotonin-docs/api/game/functions) Last updated 12 months ago --- # ui | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/ui.md) . ### [](https://serotonin-1.gitbook.io/serotonin-docs/api/ui#core-functions) Core Functions These functions are used to interact with existing UI elements. #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/ui#ui.getvalue) ui.getValue Retrieves the current value of a specified UI widget. Copy value = ui.getValue(tab_ref, container_ref, name) **Parameters** * tab\_ref (string): The reference name of the tab the widget is in. * container\_reef (string): The reference name of the container the widget is in. * name (string): The name of the widget. **Returns** * The current value of the widget. The type of the value depends on the widget (e.g., boolean for a checkbox, number for a slider, string for an input text). Returns `nil` if the widget is not found. #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/ui#ui.setvalue) ui.setValue Sets a new value for a specified UI widget. Copy ui.setValue(tab_ref, container_ref, name, new_value) **Parameters** * tab\_ref, container\_ref, name: (string) - Identifiers for the target widget. * new\_value (any): The new value to set. The type must match what the widget expects (e.g., boolean for a checkbox, number for a slider). Copy -- Turn a checkbox off ui.setValue("Aimbot", "Aimbot", "Enabled", false) -- Set a slider's value ui.setValue("Aimbot", "Aimbot", "Smoothing", 95.5) -- Set a color picker's value using a table ui.setValue("Visuals", "Visuals", "Box Color", {r=255, g=0, b=0, a=255}) #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/ui#ui.setvisibility) ui.setVisibility Shows or hides a specific UI widget. Copy ui.setVisibility(tab_ref, container_ref, name, is_visible) **Parameters** * tab\_ref, container\_ref, name: (string) - Identifiers for the target widget. * is\_visible (boolean): true to show the widget, false to hide it. Copy -- Hide the smoothing slider if the aimbot is disabled local aimbot_enabled = ui.getValue("Aimbot", "Aimbot", "Enabled") ui.setVisibility("Aimbot", "Aimbot", "Smoothing", aimbot_enabled) * * * ### [](https://serotonin-1.gitbook.io/serotonin-docs/api/ui#layout-elements) Layout Elements These functions create the main structure of your UI. #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/ui#ui.newtab) ui.newTab Creates a new top-level tab in the menu. Copy ui.newTab(tab_ref, display_name) **Parameters** * tab\_ref (string): A unique reference name for this tab (e.g., "my\_script\_tab"). * display\_name (string): The text that will be displayed on the tab button (e.g., "My Script"). Copy ui.newTab("my_script_main", "My Awesome Script") #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/ui#ui.newcontainer) ui.newContainer Creates a new container (a column) within a specified tab. All widgets must be placed inside a container. Copy ui.newContainer(tab_ref, container_ref, display_name, [options]) **Parameters** * tab\_ref (string): The reference name of the parent tab. * container\_ref (string): A unique reference name for this container. * display\_name (string): The title displayed at the top of the container. * options (table, optional): A table of boolean flags to control layout: * autosize (boolean): If true, the container's height will dynamically adjust to fit its content. * next (boolean): If true, will make the next container get placed in the right column * halfsize (boolean): If true, the container will take up half the width of a column (allowing for side-by-side containers). * visible (boolean): Defaults to true. Set to false to create a hidden container. Copy -- Create a full-height container in the left column ui.newContainer("my_script_main", "my_script_visuals", "Visuals") -- Create a second, auto-sizing container in the right column ui.newContainer("my_script_main", "my_script_misc", "Misc", { autosize = true, next = true }) * * * ### [](https://serotonin-1.gitbook.io/serotonin-docs/api/ui#ui-widgets) UI Widgets These are the interactive elements you can add to a container. #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/ui#ui.newcheckbox) ui.newCheckbox Creates a standard checkbox. * **Value Type:** boolean Copy ui.newCheckbox(tab_ref, container_ref, name, [in_line]) **Parameters** * `tab_ref`, `container_ref`, `name`: (string) - Identifiers. * `in_line` (boolean, optional): If `true`, this checkbox will attempt to render on the same line as the previous element (useful for settings buttons). #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/ui#ui.newsliderint) ui.newSliderInt Creates a slider for integer values. * **Value Type:** `number` (integer) **Signature** Copy ui.newSliderInt(tab_ref, container_ref, name, min, max, [default]) **Parameters** * `min`, `max` (number): The minimum and maximum values for the slider. * `default` (number, optional): The initial value of the slider. Defaults to `min`. #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/ui#ui.newsliderfloat) ui.newSliderFloat Creates a slider for floating-point (decimal) values. * **Value Type:** `number` (float) **Signature** Copy ui.newSliderFloat(tab_ref, container_ref, name, min, max, [default]) #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/ui#ui.newdropdown) ui.newDropdown Creates a dropdown menu for selecting one option from a list. * **Value Type:** number (integer, 1-based index of the selected option) Copy ui.newDropdown(tab_ref, container_ref, name, options_table, [default_index]) **Parameters** * options\_table (table): An array of strings representing the options. * default\_index (number, optional): The 1-based index of the option to be selected initially. Defaults to 1. #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/ui#ui.newmultiselect) ui.newMultiselect Creates a dropdown menu where multiple options can be selected at once. * **Value Type:** table (an array of booleans) Copy ui.newMultiselect(tab_ref, container_ref, name, options_table) #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/ui#ui.newcolorpicker) ui.newColorpicker Creates an interactive color picker. * **Value Type:** table (e.g., {r=255, g=128, b=0, a=255}) Copy ui.newColorpicker(tab_ref, container_ref, name, [default_color], [in_line]) **Parameters** * default\_color (table, optional): A table with r, g, b, and a keys (0-255). * in\_line (boolean, optional): If true, attempts to render on the same line. #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/ui#ui.newinputtext) ui.newInputText Creates a text input field. * **Value Type:** string Copy ui.newInputText(tab_ref, container_ref, name, [default_text]) #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/ui#ui.newbutton) ui.newButton Creates a clickable button that executes a Lua function. Copy ui.newButton(tab_ref, container_ref, name, callback_function) **Parameters** * callback\_function (function): The Lua function to execute when the button is clicked. #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/ui#ui.newlistbox) ui.newListbox Creates a listbox for selecting an item from a vertical list. Copy ui.newListbox(tab_ref, container_ref, name, options_table, [callback_function]) **Parameters** * options\_table (table): An array of strings to display in the list. * callback\_function (function, optional): A Lua function that is executed whenever a new item is selected. * * * ### [](https://serotonin-1.gitbook.io/serotonin-docs/api/ui#full-script-example) Full Script Example This example creates a new tab with two containers and populates them with various UI elements. Copy -- Create the main tab for our script ui.newTab("my_script_tab", "My ESP Script") -- Create a container for the main ESP settings in the left column, next makes the next container go to the right column ui.newContainer("my_script_tab", "esp_settings", "ESP Settings", { autosize = true, next = true }) -- Add widgets to the first container ui.newCheckbox("my_script_tab", "esp_settings", "Enable ESP") ui.newSliderFloat("my_script_tab", "esp_settings", "Max Distance", 100.0, 2000.0, 500.0) ui.newDropdown("my_script_tab", "esp_settings", "Box Style", { "Normal", "Cornered", "3D" }, 1) ui.newMultiselect("my_script_tab", "esp_settings", "Flags", { "Health", "Distance", "Weapon" }) ui.newColorpicker("my_script_tab", "esp_settings", "Box Color", {r=0, g=255, b=255, a=255}) ui.newContainer("my_script_tab", "misc_settings", "Misc", { autosize = true }) -- Add widgets to the second container ui.newInputText("my_script_tab", "misc_settings", "Custom Message", "Hello, World!") local function on_button_click() -- Use ui.getValue to make the UI interactive local is_enabled = ui.getValue("my_script_tab", "esp_settings", "Enable ESP") local message = ui.getValue("my_script_tab", "misc_settings", "Custom Message") if is_enabled then print("Button Clicked! Your message is: " .. message) else print("Button Clicked, but the ESP is disabled!") end end ui.newButton("my_script_tab", "misc_settings", "Print Message", on_button_click) print("My custom UI script has been loaded!") [Previousinput](https://serotonin-1.gitbook.io/serotonin-docs/api/input) [Nextcheat](https://serotonin-1.gitbook.io/serotonin-docs/api/cheat) Last updated 11 months ago --- # Model | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/model.md) . This is useful for creating custom scripts for games with unique PVE elements or interactive environments. #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/model#data-model) entity.AddModel(string: key, table: data) Adds a new model to the entity cache. If a model with the same `key` already exists, it will be overwritten. Parameter Type Description `key` `string` A unique identifier for this model (e.g., `"npc_1"`, `"guard_tower"`). `data` `table` A table containing the model's properties (see Data Table Fields below). **Returns:** `boolean` - `true` if successful. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/model#data-model-1) entity.RemoveModel(string: key) Removes a model from the entity cache using its unique key. Parameter Type Description `key` `string` The unique identifier of the model to remove. **Returns:** `boolean` - `true` if a model was successfully removed. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/model#data-model-2) entity.ClearModels() Removes all custom models that were added via `AddModel`. This is useful for script cleanup or when changing places. **Returns:** `boolean` - `true` if successful. * * * **Data Table Fields** The `data` table passed to `AddModel` and `EditModel` can contain the following fields: Field Type Required Description `Character` `Instance` **Yes** The Roblox `Model` instance to be tracked. `PrimaryPart` `Instance` **Yes** The root part of the model, used for positioning (e.g., `HumanoidRootPart`). `Name` `string` **Yes** A name for the entity (e.g., "Guard", "Zombie"). `DisplayName` `string` No A display name. If omitted, falls back to `Name`. `Team` `string` No The team name for friendly/enemy checks. `Weapon` `string` No The name of the weapon the model is holding. `Humanoid` `Humanoid` No Humanoid Instance, will automatically be used to get health, max health, and move direction/player states. `HealthInstance` `Instance` No **(Recommended)** An instance of a `NumberValue`, or `IntValue` for dynamic, real-time health updates. If you added a Humanoid, you might not need this. `Health` `number` No A static health value. This is only used if `HealthInstance` or `Humanoid`is not provided. `MaxHealth` `number` No The maximum health. Required if using static `Health` or a `NumberValue`/`IntValue`. * * * **Examples** This example adds an NPC with a `Humanoid` object. The API will automatically track its health, max health, and velocity in real-time. Copy local npc_model = game.Workspace:FindFirstChild("GuardNPC") if npc_model and npc_model:IsA("Model") then local humanoid = npc_model:FindFirstChildOfClass("Humanoid") if humanoid then local npc_data = { Character = npc_model, PrimaryPart = npc_model.PrimaryPart or npc_model.Head, Name = "GuardNPC", DisplayName = "Castle Guard", Team = "CastleDefenders", Humanoid = humanoid -- The API will handle everything from here } -- add the NPC with a unique key entity.AddModel("guard_1", npc_data) end end -- profit * * * This example adds a "turret" with static health. It won't update automatically, so you must use EditModel to change its health. This is ideal for objects without a Humanoid or NumberValue. Copy local turret = game.Workspace:FindFirstChild("Turret") if turret then local turret_data = { Character = turret, PrimaryPart = turret.Base, Name = "AutoTurret", Team = "Red", Health = 500, MaxHealth = 500 } entity.AddModel("turret_alpha", turret_data) end -- To update its health after it takes damage: -- entity.EditModel("turret_alpha", { Health = 400 }) [PreviousParts](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/parts) [Nextdraw](https://serotonin-1.gitbook.io/serotonin-docs/api/draw) Last updated 10 months ago --- # Color3 | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/color3.md) . Unlike the standard Roblox API, this implementation of Color3 is **mutable**. You can change its R, G, and B components directly. Values will be automatically clamped to the valid 0.0 to 1.0 range. Copy local skyColor = Color3.new(0.5, 0.7, 1.0) print(skyColor) skyColor.R = 0 -- or "r", case doesn't matter print(skyColor) #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/color3#constructor) Constructor **Color3.new(r, g, b)** Creates a new Color3 object. * **r**: (Optional) number - Red component (0-1). Defaults to 1.0. * **g**: (Optional) number - Green component (0-1). Defaults to 1.0. * **b**: (Optional) number - Blue component (0-1). Defaults to 1.0. #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/color3#properties) Properties Property Type Description .R number **(Read-Only)** The red component of the color. .G number **(Read-Only)** The green component of the color. .B number **(Read-Only)** The blue component of the color. Copy local green = Color3.new(0, 1, 0) * * * **Color3.fromRGB(r, g, b)** Creates a Color3 from components in the range **0 to 255**. * **r**: (Optional) number - Red component (0-255). Defaults to 255. * **g**: (Optional) number - Green component (0-255). Defaults to 255. * **b**: (Optional) number - Blue component (0-255). Defaults to 255. Copy local red = Color3.fromRGB(255, 0, 0) local dark_grey = Color3.fromRGB(50, 50, 50) * * * **Color3.fromHSV(h, s, v)** Creates a Color3 from Hue, Saturation, and Value components (0-1). * **h**: number - Hue component (0-1). * **s**: number - Saturation component (0-1). * **v**: number - Value component (0-1). Copy local pink = Color3.fromHSV(0.9, 0.8, 1.0) * * * **Color3.fromHex(hexString)** Creates a Color3 from a hex color code string (e.g., "#FF00FF"). The leading # is optional. * **hexString**: string - The 6-digit hex code. Copy local purple = Color3.fromHex("#8A2BE2") * * * **Properties** Property Type Description Access .R number The red component of the color (0-1). Read/Write .G number The green component of the color (0-1). Read/Write .B number The blue component of the color (0-1). Read/Write * * * **Methods** **color:Lerp(goalColor3, alpha)** -> Color3 Returns a new Color3 linearly interpolated between the two colors by alpha (0.0 to 1.0). **color:ToHSV()** -> (h, s, v) Returns the Hue, Saturation, and Value of the color as three separate number values (0-1). Copy local c = Color3.fromRGB(255, 128, 0) local h, s, v = c:ToHSV() print(h, s, v) **color:ToHex()** -> string Returns the 6-digit hex code string for the color, prefixed with #. Copy local c = Color3.new(1, 0, 1) print(c:ToHex()) --> #FF00FF [PreviousVector3](https://serotonin-1.gitbook.io/serotonin-docs/api/vector3) [NextVector3 & Color3 Example](https://serotonin-1.gitbook.io/serotonin-docs/api/vector3-and-color3-example) Last updated 12 months ago --- # cheat | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/cheat.md) . ### [](https://serotonin-1.gitbook.io/serotonin-docs/api/cheat#methods) Methods #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/cheat#cheat.register-eventname-function) `cheat.register(eventName, function)` Registers a function to be called when a specific event occurs. This is the foundation of event-driven scripting in Serotonin. **Parameters:** * `eventName: string` - The name of the event to hook into. * `function: function` - The function to be executed when the event fires. **Available Events:** Event Name Description `onUpdate` Fired at a very high frequency (~5ms). Ideal for game logic and fast loops. `onSlowUpdate` Fired at a low frequency (~1s). Ideal for non-critical background tasks. `onPaint` Fired every rendering frame. **All drawing must be done here.** `shutdown` Fired when a script is unloaded. `newPlace` Fired when a place change is detected. **Example:** Copy local function my_paint_function() draw.rect(10, 10, 50, 50, 255, 255, 255, 255) end -- Tell the engine to call our function every frame cheat.register("onPaint", my_paint_function) * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/cheat#cheat.getwindowsize) cheat.getWindowSize() Returns the width and height of the main game window in pixels. **Returns:** * width: number - The width of the window. * height: number - The height of the window. Copy local screen_w, screen_h = cheat.getWindowSize() -- Calculate the center of the screen local center_x = screen_w / 2 local center_y = screen_h / 2 -- Draw a crosshair at the center draw.line(center_x - 10, center_y, center_x + 10, center_y, 255, 255, 255, 255, 1) draw.line(center_x, center_y - 10, center_x, center_y + 10, 255, 255, 255, 255, 1) * * * [Previousui](https://serotonin-1.gitbook.io/serotonin-docs/api/ui) [Nextfile](https://serotonin-1.gitbook.io/serotonin-docs/api/file) Last updated 11 months ago --- # Functions | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/game/functions.md) . #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/functions#data-model) GetCameraPos Copy game.CameraPosition Returns a vector3 object of the camera position. * Vector3 * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/functions#data-model-1) GetService Copy game.GetService(string: Service) * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/functions#data-model-2) SilentAim Copy game.SilentAim(float: x, float: y) A function that takes screen coordinates as a parameter and will attempt to silent aim. * x: number - The X screen coordinate to aim at. * y: number - The Y screen coordinate to aim at. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/functions#data-model-3) PlayerWhitelist Copy game.PlayerWhitelist(name) Toggles the whitelist status for a player by their name. * name: string - The username of the player to toggle. * * * [Previousgame](https://serotonin-1.gitbook.io/serotonin-docs/api/game) [NextMethods](https://serotonin-1.gitbook.io/serotonin-docs/api/game/methods) Last updated 12 months ago --- # Vector3 & Color3 Example | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/vector3-and-color3-example.md) . Copy local myPart = game.Workspace.MyPart -- make the part a semi-transparent, reflective, red cube that flies up myPart.Size = Vector3.new(10, 10, 10) myPart.Color = Color3.new(255, 0, 0) myPart.Transparency = 0.5 myPart.Reflectance = 0.8 myPart.Velocity = Vector3.new(0, 50, 0) [PreviousColor3](https://serotonin-1.gitbook.io/serotonin-docs/api/color3) [Nexthttp](https://serotonin-1.gitbook.io/serotonin-docs/api/http) Last updated 1 year ago --- # http | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/http.md) . **http.Get(string: url, table: headers, function: callback)** Performs an asynchronous HTTP GET request. * **url**: The URL to send the request to. * **headers**: A table of request headers (e.g., {\["Content-Type"\] = "application/json"}). * **callback**: A function to be called with the response body (as a string) when the request is complete. Copy local headers = { ["Accept"] = "*/*", ["User-Agent"] = "MySuperSecureClient/1.0" } http.Get("https://api.example.com/data", headers, function(response) if response then print("Received data:", response) else print("The request failed.") end end) **http.Post(string: url, table: headers, string: body, function: callback)** Performs an asynchronous HTTP POST request. * **url**: The URL to send the request to. * **headers**: A table of request headers. * **body**: The string data to send in the request body. * **callback**: A function to be called with the response body (as a string) when the request is complete. Copy local headers = { ["Content-Type"] = "application/json" } local json_body = '{"username": "MyUser", "score": 100}' http.Post("https://api.example.com/submit", headers, json_body, function(response) if response then print("Server responded:", response) else print("The POST request failed.") end end) [PreviousVector3 & Color3 Example](https://serotonin-1.gitbook.io/serotonin-docs/api/vector3-and-color3-example) [Nextmemory](https://serotonin-1.gitbook.io/serotonin-docs/api/memory) Last updated 11 months ago --- # Vector3 | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/vector3.md) . Unlike the standard Roblox API, this implementation of Vector3 is **mutable**. This means you can change its components directly after creation. Copy local pos = Vector3.new(10, 20, 30) print(pos) --> 10, 20, 30 pos.X = 99 -- or x, case doesn't matter print(pos) --> 99, 20, 30 #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/vector3#constructor) Constructor **Vector3.new(x, y, z)** Creates a new Vector3 object. * x: (Optional) number - The X component. Defaults to 0. * y: (Optional) number - The Y component. Defaults to 0. * z: (Optional) number - The Z component. Defaults to 0. .X number **(Read-Only)** The X component of the vector. .Y number **(Read-Only)** The Y component of the vector. .Z number **(Read-Only)** The Z component of the vector. Copy local startPosition = Vector3.new(0, 50, 0) local direction = Vector3.new(1, 0, 1) * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/vector3#properties) Properties Property Type Description Access .X number The X component of the vector. Read/Write .Y number The Y component of the vector. Read/Write .Z number The Z component of the vector. Read/Write .Magnitude number The length (magnitude) of the vector. Read-Only .Unit Vector3 A new Vector3 with the same direction but a magnitude of 1. Read-Only * * * **Methods** Note: Methods that return a Vector3 create a **new** vector and do not modify the original. **vector:Abs()** -> Vector3 Returns a new vector with the absolute values of each component. **vector:Ceil()** -> Vector3 Returns a new vector with each component rounded up to the nearest integer. **vector:Floor()** -> Vector3 Returns a new vector with each component rounded down to the nearest integer. **vector:Sign()** -> Vector3 Returns a new vector with the sign (-1, 0, or 1) of each component. **vector:Cross(otherVector3)** -> Vector3 Returns the cross product of the two vectors. **vector:Dot(otherVector3)** -> number Returns the scalar dot product of the two vectors. **vector:Lerp(goalVector3, alpha)** -> Vector3 Returns a Vector3 linearly interpolated between the two vectors by alpha (0.0 to 1.0). **vector:Angle(otherVector3, \[axisVector3\])** -> number Returns the angle in radians between two vectors. If axis is provided, the sign of the angle is determined relative to it. **vector:FuzzyEq(otherVector3, \[epsilon\])** -> boolean Returns true if the two vectors are approximately equal. **vector:Max(otherVector3)** -> Vector3 Returns a new Vector3 with the highest components from both vectors. **vector:Min(otherVector3)** -> Vector3 Returns a new Vector3 with the lowest components from both vectors. [Previousfile](https://serotonin-1.gitbook.io/serotonin-docs/api/file) [NextColor3](https://serotonin-1.gitbook.io/serotonin-docs/api/color3) Last updated 12 months ago --- # Methods | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/game/methods.md) . #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/methods#data-model) :GetChildren() Returns a table containing all of the direct children of the Instance. Copy for _, child in ipairs(game.Workspace:GetChildren()) do print(child.Name) end * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/methods#data-model-1) :IsA(string: className) checks if the instance is of the same Class as the className * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/methods#data-model-2) :GetDescendants() Returns a table containing all objects parented to the Instance at any depth (children, children's children, etc.). Copy for _, descendant in ipairs(game.Workspace:GetDescendants()) do if descendant.ClassName == "Humanoid" then print("Found a humanoid:", descendant.Parent.Name) end end * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/methods#data-model-3) :FindFirstChild(string: name) Searches for a direct child with the given name. This is faster than iterating through :GetChildren(). Copy local camera = game.Workspace:FindFirstChild("Camera") if camera then -- do something end * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/methods#data-model-4) :FindFirstChildOfClass(string: className) Searches for a direct child with the given ClassName. Copy local humanoid = game.LocalPlayer.Character:FindFirstChildOfClass("Humanoid") * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/methods#data-model-5) :**IsDescendantOf**(**Instance: ancestor)** Checks if the instance is a descendant of the specified ancestor object. This means it is a child, a child of a child, and so on Copy local part = game.Workspace.MyCharacter.Head local character = game.Workspace.MyCharacter if part:IsDescendantOf(character) then print("The Head is a descendant of the Character.") end * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/methods#data-model-6) :**IsAncestorOf(Instance: descendant)** Checks if the instance is an ancestor of the specified descendant object. This is the reverse of :IsDescendantOf(). Copy local character = game.Workspace.MyCharacter local rightHand = character.RightHand if character:IsAncestorOf(rightHand) then print("The Character is an ancestor of the RightHand.") end * * * **:FindFirstAncestor(string: name)** Searches up the hierarchy from the instance's parent and returns the first ancestor found with the given name. If no ancestor is found, it returns nil. Copy local enginePart = game.Workspace.MyCar.Engine.EngineBlock local carModel = enginePart:FindFirstAncestor("MyCar") if carModel then print("Found the car model:", carModel.Name) end * * * **:FindFirstAncestorOfClass(string: className)** Searches up the hierarchy and returns the first ancestor that is of the specified class. Copy local humanoid = game.LocalPlayer.Character.Head:FindFirstAncestorOfClass("Humanoid") if humanoid then print("Found the humanoid by searching up from the Head.") end * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/methods#data-model-7) :**FindFirstDescendant(string: name)** Searches through all descendants of an instance and returns the first one found with the given name. This is useful for finding a specific part without knowing its exact location. Copy local character = game.LocalPlayer.Character local specialPart = character:FindFirstDescendant("EffectPart") if specialPart then print("Found the effect part somewhere in the character model.") end * * * **:FindFirstDescendantOfClass(string: className)** Searches through all descendants of an instance and returns the first one found with the specified ClassName. Copy local player = game.Players.LocalPlayer local a_humanoid = player:FindFirstDescendantOfClass("Humanoid") if a_humanoid then print("Found a humanoid within the player instance!") end * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/methods#sethighlightontop) :SetHighlightOnTop() Makes the Highlight Instance render on top of walls. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/game/methods#sethighlighttransparency-float-transparency) :SetHighlightTransparency(float: transparency) Sets the transparency of the highlight effect. * * * [PreviousFunctions](https://serotonin-1.gitbook.io/serotonin-docs/api/game/functions) [NextProperties](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties) Last updated 11 months ago --- # file | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/file.md) . #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/file#important-notes) Important Notes: * **Security and Sandbox:** For security, all file operations are sandboxed and restricted to a specific sub-folder within your main application directory, typically named files/. You **cannot** use this API to read files from arbitrary locations on the user's computer (e.g., C:\\Windows\\system32.dll). * **Path Separators:** Always use a forward slash (/) for directory separators in your paths, even on Windows. The C++ backend will handle the conversion correctly. Example: "configs/my\_settings.json". * **Naming Conventions:** All functions support PascalCase, camelCase, and snake\_case. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/file#loading-a-custom-logo) Loading a Custom Logo Draw an example logo over enemies using their bounding box. This uses the read function, utility LoadImage function, and draw.Image. Copy local LogoESP = { textureId = nil, isInitialized = false } function LogoESP:Initialize() local success, result = pcall(function() if not (file and file.read) then print("[LogoESP] Error: 'file.read' API is not available. Cannot load image.") return nil end local imageData = file.read("test_logo.png") if not imageData then return nil end return utility.loadImage(imageData) end) if success and result then self.textureId = result self.isInitialized = true else print("[LogoESP] Initialization failed.") if not success then print(" -> Error details:", result) end end end function LogoESP:OnPaint() if not self.isInitialized or not self.textureId then return end local only_enemies = false local players = entity.getPlayers(only_enemies) for i, player in ipairs(players) do local bbox = player.BoundingBox if bbox then draw.image(self.textureId, bbox.x, bbox.y, bbox.w, bbox.h, 255, 255, 255, 255) end end end LogoESP:Initialize() cheat.register("onPaint", function() LogoESP:OnPaint() end) * * * ### [](https://serotonin-1.gitbook.io/serotonin-docs/api/file#file-operations) File Operations #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/file#read) read Reads the entire content of a specified file and returns it as a string. This function can read both plain text and binary files (like images). * **Aliases:** file.Read, file.read * **Signature:** file.read(filepath) * **Parameters:** * filepath: string - The path to the file, relative to the sandboxed files/ directory. * **Returns:** string or nil - The file's content as a string. If the file does not exist or cannot be opened, it returns nil. * **Usage Examples:** **1\. Reading a text file:** Copy local welcome_message = file.read("welcome.txt") if welcome_message then print(welcome_message) end * **2\. Loading an image for the draw API:** Copy local logo_data = file.read("images/my_logo.png") if logo_data then local texture_id = utility.loadImage(logo_data) cheat.register("onPaint", function() draw.image(texture_id, 10, 10, 128, 128, 255, 255, 255, 255) end) end * * * **write** Writes string content to a specified file. If the file does not exist, it will be created. If the file already exists, its contents will be **completely overwritten**. * **Aliases:** file.Write, file.write * **Signature:** file.write(filepath, content) * **Parameters:** * filepath: string - The path to the file, relative to the sandboxed files/ directory. * content: string - The data to be written to the file. This can be binary data or plain text. * **Returns:** boolean - true if the file was written successfully, false otherwise. * **Usage Examples:** **1\. Saving a simple log:** Copy local success = file.write("log.txt", "hello") if not success then print("Failed to write to log file!") end [Previouscheat](https://serotonin-1.gitbook.io/serotonin-docs/api/cheat) [NextVector3](https://serotonin-1.gitbook.io/serotonin-docs/api/vector3) Last updated 11 months ago --- # utility | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/utility.md) . utility.RandomInt(min, max) Returns a random integer between min and max (inclusive). #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/utility#utility.randomfloat-min-max) utility.RandomFloat(min, max) Returns a random floating-point number between min and max. #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/utility#utility.gettickcount) utility.GetTickCount() Returns the number of milliseconds that have elapsed since the system was started. **Returns:** * number **utility.GetFingerprint()** Returns a unique hardware identifier (fingerprint) for the current user. **utility.SetClipboard(string: content)** Sets the system clipboard to the specified text content. Copy utility.SetClipboard("This text is now in the clipboard!") **utility.GetClipboard()** Returns the current text content from the system clipboard as a string. **utility.MoveMouse(integer: dx, integer: dy)** Moves the mouse cursor relative to its current position. * **dx**: The number of pixels to move horizontally (positive is right, negative is left). * **dy**: The number of pixels to move vertically (positive is down, negative is up). Copy -- Move the mouse 50 pixels to the right and 20 pixels up utility.MoveMouse(50, -20) #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/utility#utility.getdeltatime) utility.GetDeltaTime() Returns the time in seconds it took to complete the last frame. Useful for framerate-independent animations. **Returns:** * number #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/utility#utility.getmousepos) utility.GetMousePos() Returns the mouse position. **Returns:** * vector2 table #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/utility#utility.getmenustate) utility.GetMenuState() Returns the menu state. **Returns:** * boolean #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/utility#utility.worldtoscreen-vector3-object) utility.WorldToScreen(Vector3: object) Converts a Vector3 object of coordinates into a 2D screen coordinate. **Returns:** * screenX: number - The X coordinate on the screen. * screenY: number - The Y coordinate on the screen. * onScreen: boolean - true if the point is within the visible screen area. * * * Copy local part = game.Workspace.MyPart local part_position_vector = part.Position -- This is a Vector3 object local sx, sy, is_on_screen = utility.world_to_screen(part_position_vector) if is_on_screen then draw.text("Here!", sx, sy, Color3.new(1, 1, 1)) end * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/utility#loadimage) LoadImage Loads raw image data (e.g., from a .png or .jpg file) into a GPU texture and returns a handle to it. This handle is then used by draw.Image. * **Aliases:** utility.LoadImage, utility.loadImage, utility.load\_image * **Signature:** utility.LoadImage(image\_data) * **Parameters:** * image\_data: string - The raw binary content of an image file, typically read using file.read(). * **Returns:** integer - A unique texture ID to be used with draw.Image. Returns nil or throws an error on failure. * **Example:** Generated lua Copy local image_data = file.read("my_logo.png") if image_data then local logo_texture_id = utility.load_image(image_data) if logo_texture_id then cheat.register("onPaint", function() draw.image(logo_texture_id, 50, 50, 100, 100, 255, 255, 255, 255) end) end end [Previousaudio](https://serotonin-1.gitbook.io/serotonin-docs/api/audio) [Nextinput](https://serotonin-1.gitbook.io/serotonin-docs/api/input) Last updated 11 months ago --- # audio | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/audio.md) . * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/audio#audio.playsound) audio.playSound Plays a sound from a `.wav` file. **Parameters** * `wav_data` (**string**): The raw binary content of the `.wav` file, typically read using `file.read()`. * `loop` (**boolean**, _optional_): If `true`, the sound will loop indefinitely until stopped by `audio.stopAll()`. * `volume` (**number**, _optional_): The playback volume. `1.0` is normal volume. `0.0` is silent. Values can go up to `2.0`. Defaults to `1.0`. * `pitch` (**number**, _optional_): The frequency multiplier for the sound's pitch. `1.0` is the original pitch. `0.5` is one octave lower, `2.0` is one octave higher. Defaults to `1.0`. Copy local my_sound = file.read("explosion.wav") if my_sound then -- Play the sound once at 75% volume and a slightly higher pitch audio.playSound(my_sound, false, 0.75, 1.1) end * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/audio#audio.beep) audio.beep Generates and plays a simple sine wave beep sound. This is useful for notifications or debugging. **Parameters** * frequency (**integer**): The frequency of the beep in hertz (Hz). A standard 'A' note is 440Hz. * duration (**integer**): The duration of the beep in milliseconds (ms). Copy -- Play a short, high-pitched notification beep audio.beep(880, 200) * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/audio#audio.stopall) audio.stopAll Immediately stops all sounds that were started with loop = true. One-shot sounds that are already finished are unaffected. **Parameters** None. Copy -- Start some looping background music local music_data = file.read("music.wav") if music_data then audio.playSound(music_data, true, 0.5) end audio.stopAll() * * * ### [](https://serotonin-1.gitbook.io/serotonin-docs/api/audio#full-script-example) Full Script Example This example creates a UI with sliders and buttons to test all functions of the audio library. You need to use ur own test\_sound.wav file. Copy ui.newTab("Audio", "Audio Controls") ui.newContainer("Audio", "SoundControls", "Sound Controls", { halfsize = true, next = true }) ui.newContainer("Audio", "MiscControls", "Miscellaneous", { halfsize = true }) local sound_data = file.read("test_sound.wav") if not sound_data then return end local volume_ref = ui.newSliderFloat("Audio", "SoundControls", "Volume", 0.0, 2.0, 1.0) local pitch_ref = ui.newSliderFloat("Audio", "SoundControls", "Pitch", 0.1, 2.0, 1.0) ui.newButton("Audio", "SoundControls", "Play One-Shot Sound", function() local vol = ui.getValue(volume_ref) local pitch = ui.getValue(pitch_ref) print("Playing sound with Volume: " .. vol .. ", Pitch: " .. pitch) audio.playSound(sound_data, false, vol, pitch) end) local is_music_playing = false ui.newButton("Audio", "SoundControls", "Play/Stop Looping Music", function() if is_music_playing then audio.stopAll() is_music_playing = false else local vol = ui.getValue(volume_ref) local pitch = ui.getValue(pitch_ref) audio.playSound(sound_data, true, vol, pitch) is_music_playing = true end end) ui.newButton("Audio", "MiscControls", "Play Beep (440Hz)", function() audio.beep(440, 500) end) ui.newButton("Audio", "MiscControls", "STOP ALL SOUNDS", function() audio.stopAll() is_music_playing = false end) [Previousdraw](https://serotonin-1.gitbook.io/serotonin-docs/api/draw) [Nextutility](https://serotonin-1.gitbook.io/serotonin-docs/api/utility) Last updated 7 months ago --- # Players | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players.md) . #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players#data-model) GetPlayers(\[onlyEnemies\]) Returns a table containing the integer indices of all currently cached players. **Parameters:** * `onlyEnemies: boolean` (optional) - If `true`, only returns indices of players who are on an enemy team. Defaults to `false`. Copy -- Get all players local all_players = entity.GetPlayers() -- Get only enemies local enemy_players = entity.GetPlayers(true) print("Total players:", #all_players) print("Total enemies:", #enemy_players) * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players#data-model-1) GetLocalPlayer() Returns the index of the local player. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players#data-model-2) .Name **Returns:** string - The player's username. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players#displayname) .DisplayName **Returns:** string - The player's display name. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players#userid) .UserId **Returns:** number - The player's unique UserID. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players#team) .Team **Returns:** string - The name of the player's team. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players#data-model-3) .Weapon **Returns:** string - The name of the weapon the player is currently holding. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players#position) .Position The 3D world position of the player's position. (Vector3 Object) * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players#velocity) .Velocity The current velocity of the player as a Vector3. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players#health) .Health **Returns:** number - The player's current health. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players#data-model-4) .MaxHealth **Returns:** number - The player's maximum health. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players#isalive) .IsAlive **Returns:** boolean - true if the player's health is greater than 0. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players#data-model-5) .IsEnemy **Returns:** boolean - true if the player is on an opposing team. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players#isvisible) .IsVisible **Returns:** boolean - true if the player is visible (not occluded by walls). * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players#iswhitelisted) .IsWhitelisted **Returns:** boolean - true if the player is on the global player whitelist. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players#boundingbox) .BoundingBox A table with .x, .y, .w, .h fields for the 2D screen-space bounding box. * x: number, y: number - The top-left corner of the box. * w: number, h: number - The width and height of the box. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players#teamcolor) .TeamColor The Color3 object representing the player's team color. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players#data-model-6) :GetBonePosition(string: boneName) Returns the 3D world position of a specific bone as a Vector3 object. boneName is a string (e.g., "Head", "HumanoidRootPart"). * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players#getboneinstance-string-bonename) :GetBoneInstance(string: boneName) Returns the actual Part Instance of a specific bone, which you can then manipulate with the game API. * * * **:GetBoneSize(boneName)** Returns the size of a specific bone. * **Parameters:** * boneName: string - The name of the bone. * **Returns:** * Vector3 - The size of the bone, or nil if not found. * * * **:GetBoneRotation(boneName)** Returns the rotation of a specific bone as a 3x3 matrix. * **Parameters:** * boneName: string - The name of the bone. * **Returns:** * table - An array-like table with 9 number elements representing the rotation matrix, or nil if not found. * * * **Example for Bone Methods** Copy local localplayer = entity.GetLocalPlayer() if not localplayer then return end local head_instance = localplayer:GetBoneInstance("Head") local head_pos = localplayer:GetBonePosition("Head") local head_size = localplayer:GetBoneSize("Head") if head_instance then local corners = draw.GetPartCorners(head_instance) -- you can now draw the corners, refer to the drawing API to see how -- to go from here end if head_pos and head_size then print("Head is at " .. head_pos.x .. " and is " .. head_size.y .. " studs tall.") end [Previousentity](https://serotonin-1.gitbook.io/serotonin-docs/api/entity) [NextParts](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/parts) Last updated 1 year ago --- # memory | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/api/memory.md) . **IMPORTANT:** Direct memory manipulation is a powerful but advanced feature. Incorrect usage, such as writing to the wrong address or using an incorrect data type, can easily cause the game client to crash. Use these functions with caution. #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/memory#supported-data-types) **Supported Data Types** The type parameter in memory.Read and memory.Write accepts the following case-insensitive strings: Type String C++ Type Lua Type Notes "float" float number "double" double number "int" int32\_t number 32-bit signed integer "uint" uint32\_t number 32-bit unsigned integer "bool" bool boolean "byte" uint8\_t number 8-bit unsigned integer "short" int16\_t number 16-bit signed integer "ushort" uint16\_t number 16-bit unsigned integer "int64" int64\_t number 64-bit signed integer "uint64" uint64\_t number 64-bit unsigned integer "pointer" / "ptr" uintptr\_t number A memory address "string" char\[\] string Reads/writes a standard C-style string "vector2" vector2 Vector2 "vector3" vector Vector3 "color3" vector Color3 Stored as a Vector3 in memory "cframe" CFrame table Read-only * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/memory#memory.read) **memory.Read** Reads a value of a specified data type from a given memory address. > Copy > > memory.Read(type, address) **Parameters:** * **type** (string): The data type to read. See the supported data types table above. * **address** (number): The raw memory address to read from. **Returns:** * (any): The value read from memory, converted to the appropriate Lua type, or nil on failure. Copy local local_player = game.LocalPlayer local character = local_player and local_player.Character local humanoid = character and character:FindFirstChild("Humanoid") if humanoid then local humanoid_addr = humanoid.Address -- Offset for WalkSpeed local walkspeed_addr = humanoid_addr + 0x1d4 local current_speed = memory.Read("float", walkspeed_addr) print("Current WalkSpeed from memory:", current_speed) end * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/memory#memory.write) **memory.Write** Writes a new value to a specified memory address. > Copy > > memory.Write(type, address, value) **Parameters:** * **type** (string): The data type to write. * **address** (number): The raw memory address to write to. * **value** (any): The new value to write. The type of this value must match the type parameter. **Returns:** * (nil) Copy local humanoid = game.LocalPlayer.Character and game.LocalPlayer.Character.Humanoid if humanoid then local humanoid_addr = humanoid.Address -- Offset for HipHeight local hipheight_addr = humanoid_addr + 0x1a0 -- Write a new float value to the address memory.Write("float", hipheight_addr, 5.0) end * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/memory#memory.getbase) **memory.GetBase** Retrieves the base address of the main game module. > Copy > > memory.GetBase() **Returns:** * (number): The base address of the RobloxPlayerBeta.exe module. * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/api/memory#memory.rebase) **memory.Rebase** A utility function to calculate an address by adding an offset to the game's base address. This is useful for static addresses. > Copy > > memory.Rebase(offset) **Parameters:** * **offset** (number): The offset to add to the base address. **Returns:** * (number): The resulting rebased address. [Previoushttp](https://serotonin-1.gitbook.io/serotonin-docs/api/http) Last updated 8 months ago --- # Unknown \# Serotonin Docs ## Serotonin - \[Serotonin Lua Documentation\](https://serotonin-1.gitbook.io/serotonin-docs/serotonin-lua-documentation.md): Welcome to the official documentation for the Serotonin scripting environment. This guide provides all the necessary information to create powerful scripts that interact with Roblox. - \[What is this?\](https://serotonin-1.gitbook.io/serotonin-docs/overview/what-is-this.md) - \[Core Concepts\](https://serotonin-1.gitbook.io/serotonin-docs/overview/core-concepts.md) - \[Setting Up\](https://serotonin-1.gitbook.io/serotonin-docs/product-guides/setting-up.md) - \[ Creating a Simple ESP\](https://serotonin-1.gitbook.io/serotonin-docs/product-guides/creating-a-simple-esp.md) - \[API\](https://serotonin-1.gitbook.io/serotonin-docs/api.md) - \[game\](https://serotonin-1.gitbook.io/serotonin-docs/api/game.md): The \\\`game\\\` global is a table that acts as the primary entry point for accessing game services and core objects. - \[Functions\](https://serotonin-1.gitbook.io/serotonin-docs/api/game/functions.md) - \[Methods\](https://serotonin-1.gitbook.io/serotonin-docs/api/game/methods.md) - \[Properties\](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties.md) - \[Attributes\](https://serotonin-1.gitbook.io/serotonin-docs/api/game/attributes.md): The attribute system allows you to access custom data attached to any Instance. - \[FFlags\](https://serotonin-1.gitbook.io/serotonin-docs/api/game/fflags.md): Functions for reading and writing Fast Flags (FFlags), which are internal variables used by the game engine to control features and behavior. - \[entity\](https://serotonin-1.gitbook.io/serotonin-docs/api/entity.md): The \\\`entity\\\` library is a high-performance interface for accessing pre-cached information about players and parts in the game. It is designed for tasks that need to run quickly and frequently. - \[Players\](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players.md) - \[Parts\](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/parts.md) - \[Model\](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/model.md): The Custom Model API allows you to add non-player models (like NPCs, animals, or other interactive objects) to the entity cache. Once added, these models are treated like native players. - \[draw\](https://serotonin-1.gitbook.io/serotonin-docs/api/draw.md): The \\\`draw\\\` library provides all the functions necessary to draw 2D shapes, and text directly onto the screen. - \[audio\](https://serotonin-1.gitbook.io/serotonin-docs/api/audio.md): The \\\`audio\\\` library allows scripts to play sound effects and musical tones. It provides functions for playing \\\`.wav\\\` files with control over volume and pitch. - \[utility\](https://serotonin-1.gitbook.io/serotonin-docs/api/utility.md): The \\\`utility\\\` library contains general-purpose helper functions for tasks like math, logging, and time. - \[input\](https://serotonin-1.gitbook.io/serotonin-docs/api/input.md) - \[ui\](https://serotonin-1.gitbook.io/serotonin-docs/api/ui.md): The ui library provides a powerful interface for Lua scripts to create, manage, and interact with native menu elements. This allows you to build custom configuration windows for your scripts. - \[cheat\](https://serotonin-1.gitbook.io/serotonin-docs/api/cheat.md): The \\\`cheat\\\` library provides core functions for managing script execution, callbacks, and global state. - \[file\](https://serotonin-1.gitbook.io/serotonin-docs/api/file.md): The file library provides functions for interacting with the local filesystem. This is crucial for loading external resources like images, configuration files, and more. - \[Vector3\](https://serotonin-1.gitbook.io/serotonin-docs/api/vector3.md): A data type representing a 3D coordinate or direction. - \[Color3\](https://serotonin-1.gitbook.io/serotonin-docs/api/color3.md): A data type representing an RGB color. - \[Vector3 & Color3 Example\](https://serotonin-1.gitbook.io/serotonin-docs/api/vector3-and-color3-example.md) - \[http\](https://serotonin-1.gitbook.io/serotonin-docs/api/http.md): The http library provides functions for making asynchronous web requests. - \[memory\](https://serotonin-1.gitbook.io/serotonin-docs/api/memory.md): The memory global library provides low-level functions for directly interacting with the game's process memory. This allows for reading and writing values at specific memory addresses. --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on a page URL with the \`ask\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/serotonin-lua-documentation.md?ask= \`\`\` The question should be specific, self-contained, and written in natural language. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/serotonin-lua-documentation.md). # Serotonin Lua Documentation ## Overview > The Serotonin Scripting API provides a high-performance, object-oriented environment for creating custom game modifications. You can manipulate game objects, draw custom overlays, and automate actions with a clean and modern Lua API. > > Our API is designed to be powerful and intuitive. Instead of low-level memory manipulation, you interact with clearly defined objects, properties, and methods that will feel familiar to anyone with experience on the Roblox platform. > > From a simple ESP to complex aiming mechanics, the API provides the tools you need. --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/serotonin-lua-documentation.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/overview/what-is-this.md). # What is this? {% hint style="info" %} The Serotonin scripting engine allows you to write \`.lua\` files to modify your game experience. It's built on LuaJIT for maximum performance and uses a modern C++ wrapper to expose a safe and easy-to-use API. {% endhint %} \*\*\* \* \*\*Performance:\*\* Scripts run in a high-performance Just-In-Time compiled environment. \* \*\*Security:\*\* The API is designed to be safe, with restricted access to the filesystem and network by default. \* \*\*Ease of Use:\*\* A clean, object-oriented API with clear naming conventions lets you focus on logic instead of boilerplate. --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/overview/what-is-this.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api.md). # API \[game\](/serotonin-docs/api/game.md) \[entity\](/serotonin-docs/api/entity.md) \[draw\](/serotonin-docs/api/draw.md) \[utility\](/serotonin-docs/api/utility.md) \[cheat\](/serotonin-docs/api/cheat.md) --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/draw.md). # draw {% hint style="info" %} \*\*IMPORTANT:\*\* All \`draw\`functions must be called from within a function registered to the \`onPaint\` callback. {% endhint %} {% hint style="info" %} All color parameters are integers ranging from \*\*0 to 255\*\*. {% endhint %}

This script will draw a Polyline tracing the local player's Head.

\`\`\`lua local TARGET\_BONE\_NAME = "Head" local OUTLINE\_COLOR = Color3.new(0, 1, 1) local OUTLINE\_THICKNESS = 2.0 local OUTLINE\_ALPHA = 255 local function on\_paint() local local\_player = entity.get\_local\_player() if not local\_player then return end local head = local\_player:get\_bone\_instance(TARGET\_BONE\_NAME) if not head then return end local world\_points = draw.get\_part\_corners(head) if not world\_points then return end local screen\_points = {} for i, world\_pos in ipairs(world\_points) do local screen\_x, screen\_y, is\_on\_screen = utility.world\_to\_screen(world\_pos) if is\_on\_screen then table.insert(screen\_points, { screen\_x, screen\_y }) end end if #screen\_points < 3 then return end local hull\_points = draw.compute\_convex\_hull(screen\_points) if not hull\_points or #hull\_points < 2 then return end draw.polyline(hull\_points, OUTLINE\_COLOR, true, OUTLINE\_THICKNESS, OUTLINE\_ALPHA) end cheat.register("onPaint", on\_paint) \`\`\` #### draw\\.Line(x1, y1, x2, y2, color, \\\[thickness\], \\\[alpha\]) Draws a line between two points. \*\*Parameters:\*\* \* \`x1, y1: number\` - Start coordinates. \* \`x2, y2: number\` - End coordinates. \* \`color\` - Color3 object. \* \`alpha: number\` - (optional, default = 255) - the alpa transparency of the color. \* \`thickness: number\` - The thickness of the line in pixels. \*\*\* #### draw\\.Rect(x, y, w, h, color, \\\[thickness\], \\\[rounding\], \\\[alpha\]) Draws the outline of a rectangle. \* \*\*Parameters:\*\* \* x, y: number - Top-left corner coordinates. \* w, h: number - Width and height. \* color: Color3 - The color of the outline. \* alpha: number (optional, default=255) - The alpha transparency of the color. \* thickness: number (optional, default=1.0) - The thickness of the outline. \* rounding: number (optional, default=0.0) - The radius of the corner rounding. \*\*\* #### draw\\.RectFilled(x, y, w, h, color, \\\[rounding\], \\\[alpha\]) Draws a filled rectangle. \* \*\*Parameters:\*\* \* x, y: number - Top-left corner coordinates. \* w, h: number - Width and height. \* color: Color3 - The fill color. \* alpha: number (optional, default=255) - The alpha transparency of the color. \* rounding: number (optional, default=0.0) - The radius of the corner rounding. \*\*\* #### draw\\.Circle(x, y, radius, color, \\\[thickness\], \\\[segments\], \\\[alpha\]) Draws the outline of a circle. \* \*\*Parameters:\*\* \* x, y: number - Center coordinates. \* radius: number - The radius of the circle. \* color: Color3 - The color of the outline. \* alpha: number (optional, default=255) - The alpha transparency of the color. \* thickness: number (optional, default=1.0) - The thickness of the outline. \* segments: integer (optional, default=12) - The number of segments to use. More segments result in a smoother circle. \*\*\* #### draw\\.CircleFilled(x, y, radius, color, \\\[segments\], \\\[alpha\]) Draws a filled circle. \* \*\*Parameters:\*\* \* x, y: number - Center coordinates. \* radius: number - The radius of the circle. \* color: Color3 - The fill color. \* alpha: number (optional, default=255) - The alpha transparency of the color. \* segments: integer (optional, default=12) - The number of segments to use. More segments result in a smoother circle. \*\*\* #### draw\\.Triangle(x1, y1, x2, y2, x3, y3, color, \\\[thickness\], \\\[alpha\]) Draws the outline of a triangle defined by three points. \* \*\*Parameters:\*\* \* x1, y1: number - Coordinates of the first point. \* x2, y2: number - Coordinates of the second point. \* x3, y3: number - Coordinates of the third point. \* color: Color3 - The color of the outline. \* alpha: number (optional, default=255) - The alpha transparency of the color. \* thickness: number (optional, default=1.0) - The thickness of the outline. \*\*\* #### draw\\.TriangleFilled(x1, y1, x2, y2, x3, y3, color, \\\[alpha\]) Draws a filled triangle defined by three points. \* \*\*Parameters:\*\* \* x1, y1: number - Coordinates of the first point. \* x2, y2: number - Coordinates of the second point. \* x3, y3: number - Coordinates of the third point. \* color: Color3 - The fill color. \* alpha: number (optional, default=255) - The alpha transparency of the color. \*\*\* #### draw\\.Gradient(x, y, w, h, startColor, endColor, isHorizontal, \\\[startAlpha\], \\\[endAlpha\]) Draws a rectangle with a two-color gradient. \* \*\*Parameters:\*\* \* x, y, w, h: number - The position and size. \* startColor, endColor: Color3 - The gradient colors. \* isHorizontal: boolean - true for left-to-right, false for top-to-bottom. \* startAlpha: number (optional, default=255) - Alpha for startColor. \* endAlpha: number (optional, default=255) - Alpha for endColor. \*\*\* #### draw\\.Image(textureId, x, y, w, h, r, g, b, a) Draws a filled triangle defined by three points. \* \*\*Parameters:\*\* \* textureId: integer - The ID from utility.loadImage. \* x, y, w, h: number - The position and size. \* r, g, b, a: integer - The tint color (0-255). \*\*\* #### draw\\.Text(text, x, y, color, \\\[font\], \\\[alpha\]) Draws text on the screen using a specified font. \* \*\*Parameters:\*\* \* \`text\`: \`string\` - The text to draw. \* \`x\`, \`y\`: \`number\` - Top-left coordinates for the text. \* \`color\`: \`Color3\` - The color of the text. \* \`font\`: \`string\` (optional) - The name of the font to use. If omitted, the default font will be used. Available fonts: \* \`"ConsolasBold"\` \* \`"SmallestPixel"\` \* \`"Verdana"\` \* \`"Tahoma"\` \* \`alpha\`: \`number\` (optional, default=255) - The alpha transparency of the color. \*\*\* #### draw\\.TextOutlined(text, x, y, color, \\\[font\],\\\[alpha\]) Draws text with a standard black outline for high contrast and better readability. \* \*\*Parameters:\*\* \* text: string - The text to draw. \* x, y: number - Top-left coordinates for the text. \* color: Color3 - The color of the text. \* font: string (optional) - The name of the font to use. If omitted, the default font will be used. Available fonts: \* "ConsolasBold" \* "SmallestPixel" \* "Verdana" \* "Tahoma" \* alpha: number (optional, default=255) - The alpha transparency of the color. \`\`\`lua local white = Color3.new(1, 1, 1) -- Draw with the default font draw.TextOutlined("PlayerName \[100m\]", 150, 200, white) draw.TextOutlined("Objective", 150, 220, white, "Verdana", 150) \`\`\` \*\*\* #### draw\\.GetTextSize(text, \\\[font\]) Calculates the width and height of a string, without actually drawing it. This is useful for positioning elements. \* \*\*Parameters:\*\* \* text: string - The text to measure. \* font: string (optional) - The name of the font to use. If omitted, the default font will be used. Available fonts: \* "ConsolasBold" \* "SmallestPixel" \* "Verdana" \* "Tahoma" \* \*\*Returns:\*\* \* width: number \* height: number \* Example: \`\`\`lua local my\_text = "Hello, World!" local text\_width, text\_height = draw.get\_text\_size(my\_text) print("Text is " .. text\_width .. " pixels wide and " .. text\_height .. " pixels high.") \`\`\` \*\*\* #### draw\\.ComputeConvexHull(points) Takes a set of 2D points and returns the smallest possible convex polygon that encloses all of them. This is extremely useful for drawing an outline around multiple, potentially overlapping shapes to create a single, clean silhouette. \* \*\*Parameters:\*\* \* points: table - An array-like table of points to process (e.g., { {x1, y1}, {x2, y2}, ... }). \* \*\*Returns:\*\* \* hull\\\_points: table - A new table of points representing the vertices of the convex hull, ready to be used with draw\\.Polyline or draw\\.ConvexPolyFilled. \`\`\`lua local all\_points = { {100, 100}, {200, 100}, {250, 150}, {250, 250}, {150, 250}, {100, 200} } local silhouette = draw.compute\_convex\_hull(all\_points) draw.convex\_poly\_filled(silhouette, Color3.new(1, 0, 0), 128) local white\_color = Color3.new(1, 1, 1) draw.Polyline(silhouette, white\_color, true, 2.0) -- no alpha passed, defaults to 255 \`\`\` \*\*\* #### draw\\.Polyline(points, color, closed, thickness, \\\[alpha\]) Draws a series of connected lines through a set of points. \* \*\*Parameters:\*\* \* points: table - An array of points, e.g., { {x1, y1}, {x2, y2}, ... }. \* color: Color3 - The color of the lines. \* closed: boolean - If true, connects the last point to the first. \* thickness: number - The thickness of the lines in pixels. \* alpha: number (optional, default=255) - The alpha transparency. \`\`\`lua local star\_points = { {100, 20}, {110, 60}, {150, 60}, {120, 85}, {130, 125}, {100, 100}, {70, 125}, {80, 85}, {50, 60}, {90, 60} } -- draw an open red star shape (alpha will default to 255) draw.Polyline(star\_points, Color3.new(1, 0, 0), false, 2.0) for i, p in ipairs(star\_points) do p\[1\] = p\[1\] + 150 end draw.Polyline(star\_points, Color3.new(0, 0, 1), true, 2.0, 128) \`\`\` \*\*\* #### draw\\.ConvexPolyFilled(points, color, \\\[alpha\]) Draws a filled, convex polygon. A convex polygon has no "inward-pointing" corners. \* \*\*Parameters:\*\* \* points: table - An ordered array of vertices. \* color: Color3 - The fill color. \* alpha: number (optional, default=255) - The alpha transparency. \`\`\`lua local hexagon\_points = { {200, 200}, {250, 200}, {275, 243}, {250, 286}, {200, 286}, {175, 243} } local green = Color3.new(0, 255, 0) draw.ConvexPolyFilled(hexagon\_points, green, 128) \`\`\` \*\*\* #### draw\\.GetPartCorners(part) Calculates the 8 world-space corners of a part's bounding box, accounting for its position, size, and rotation. This is the recommended way to get points for drawing an outline around a part. \* \*\*Parameters:\*\* \* part: Instance - The Part object to process. \* \*\*Returns:\*\* \* corners\\\_table: table - A table containing 8 Vector3 objects representing each corner, or nil if the part is invalid. \`\`\`lua local head = entity.GetLocalPlayer():GetBoneInstance("Head") if head then local corners\_3d = draw.GetPartCorners(head) if corners\_3d then -- Now you can loop through 'corners\_3d' and use utility.worldToScreen on each one -- to get the 2D points needed for drawing. end end \`\`\` \*\*\* --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/draw.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/product-guides/setting-up.md). # Setting Up

🛠️ Setting Up Your First Script

1\\. Create a Lua File Create a new text file and save it with a \`.lua\` extension (e.g., \`my-first-script.lua\`). #### 2. Place it in the Scripts Folder Find the Serotonin data folder on your computer and place your new \`.lua\` file inside the \`scripts\` subdirectory. You can use the "Open Scripts Folder" button in the menu's Scripting tab to get there quickly. #### 3. Write Your Code Open the file in a text editor (like VS Code, Notepad++, or Sublime Text) and write your script. A simple "Hello, World!" script looks like this: \*\*\* \`\`\`lua print("Hello from my first script!") -- Draw a green square on the screen local function draw\_square() draw.rect(500, 500, 50, 50, 0, 255, 0, 255) end -- Register our drawing function to the onPaint event cheat.register("onPaint", draw\_square) \`\`\` \*\*\* #### 4. Load the Script In the Serotonin menu, navigate to the \*\*Scripting\*\* tab. Your new script should appear in the list. 1. Click on your script's name in the listbox. 2. Click the \*\*"Load"\*\* button. You should now see the message in the console and a green square on your screen! --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/product-guides/setting-up.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/game/fflags.md). # FFlags \*\*\* \*\*game.GetFFlag(name, type)\*\* Retrieves the value of a given FFlag, casting it to the specified type. \* \*\*Parameters:\*\* \* name: string - The case-sensitive name of the FFlag. \* type: string - The expected data type of the FFlag. Must be one of "bool", "int", "float", or "double". \* \*\*Returns:\*\* \* any | nil: The value of the FFlag cast to the specified type, or nil if the flag is not found. \`\`\`lua local physics\_steps = game.GetFFlag("PhysicsStepsPerSecond", "float") if physics\_steps ~= nil then print("Physics steps per second:", physics\_steps) end -- Example of a non-existent flag local not\_found = game.GetFFlag("ThisFlagDoesNotExist", "int") if not\_found == nil then print("Correctly reported that the FFlag was not found.") end \`\`\` \*\*\* \*\*game.SetFFlag(name, value, type)\*\* Sets the value of a given FFlag, writing it as the specified type. \* \*\*Parameters:\*\* \* name: string - The case-sensitive name of the FFlag. \* value: any - The new value for the FFlag. \* type: string - The data type to write the value as. Must be one of "bool", "int", "float", or "double". \* \*\*Returns:\*\* \* boolean: true if the FFlag was found and the value was written successfully, false otherwise. \`\`\`lua -- Enable a boolean FFlag local success = game.SetFFlag("DebugDrawBroadPhaseAABBs", true, "bool") if success then print("Enabled broad phase debug drawing.") end -- Set the physics framerate game.SetFFlag("PhysicsStepsPerSecond", 240.0, "float") -- Set an integer value game.SetFFlag("SomeIntegerValue", 100, "int") \`\`\` --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/game/fflags.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/input.md). # input

Mouse

{% hint style="info" %} The mouse library provides functions to simulate mouse actions and check the state of mouse buttons. {% endhint %} #### 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:\*\* \`\`\`lua -- 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:\*\* \`\`\`lua 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:\*\* \`\`\`lua -- This would simulate scrolling the wheel down by one "tick". mouse.scroll(-1) \`\`\` \*\*\*

Keyboard

{% hint style="info" %} The keyboard library provides functions to simulate key presses and check the state of keyboard keys. {% endhint %} #### 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:\*\* \`\`\`lua -- 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:\*\* \`\`\`lua -- Stop walking forward. keyboard.release("w") \`\`\` #### Click Simulates a complete key press-and-release action, often called a 'keypress' or 'click'. It sends a 'key down' event, waits for a specified duration, and then sends a 'key up' event. This is perfect for single actions like typing a character or activating an ability. \* \*\*Aliases:\*\* keyboard.Click, keyboard.click \* \*\*Signature:\*\* keyboard.Click(key, \\\[delay\]) \* \*\*Parameters:\*\* \* key: string|integer - The key to click. \* delay: integer (optional) - The duration to hold the key in milliseconds. Defaults to a brief, human-like delay (e.g., 50ms) if omitted.
-- Quickly tap the 'E' key
keyboard.click("e")

-- Send a message in chat by clicking 'enter' with a longer delay (100 ms).
keyboard.click("enter", 100)
#### 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:\*\* \`\`\`lua 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) \`\`\` --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/input.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/game/attributes.md). # Attributes \*\*\* The core functions return an \*\*Attribute Table\*\*, which is a standard Lua table with the following structure: \* .Name (string): The name of the attribute. \* .TypeName (string): The data type of the attribute (e.g., "string", "CoordinateFrame", "Rect2D"). \* .Value: The attribute's value. The format of this value depends on its TypeName. \*\*\* \*\*:GetAttributes()\*\* Retrieves a table containing all attributes attached to the Instance. This is the most efficient way to inspect every attribute on an object at once. The function returns an array-like table where each element is another table representing a single attribute. Each attribute table contains three key-value pairs: \* .Name (string): The name of the attribute. \* .TypeName (string): The type of the attribute (e.g., "string", "Color3", "number"). \* .Value: The actual value of the attribute, with a data type matching its TypeName. \*\*Returns\*\* \* (table) An array of attribute tables. \*\*Example: Inspecting All Attributes\*\* This example iterates through all attributes on a Part named "TestPart" and prints their details. \`\`\`lua local testPart = game.Workspace.TestPart local allAttributes = testPart:GetAttributes() print("Attributes for: " .. testPart.Name) for \_, attr in ipairs(allAttributes) do -- attr is a table like { Name = "TestName", TypeName = "string", Value = "TestValue" } print(string.format(" -> Name: %s, Type: %s", attr.Name, attr.TypeName)) end \`\`\` \*\*Expected Output:\*\* \`\`\`lua Attributes for: TestPart -> Name: MyString, Type: string -> Name: MyColor, Type: Color3 -> Name: IsActive, Type: boolean \`\`\` ### \*\*:GetAttribute(string: name)\*\* Finds and returns a single attribute by its exact name. This is the simplest way to get the value of a specific, known attribute. \*\*Parameters\*\* \* name (string): The case-sensitive name of the attribute to find. \*\*Returns\*\* \* (table) An attribute table with .Name, .TypeName, and .Value fields if found. \* nil if no attribute with the specified name exists on the Instance. \*\*Example: Retrieving a Specific Attribute\*\* This example looks for an attribute named "SpecialID" and prints its value. \`\`\`lua local testPart = game.Workspace.TestPart local idAttribute = testPart:GetAttribute("SpecialID") if idAttribute then -- The attribute was found, we can safely access its value print("Found attribute 'SpecialID'.") print(" - Type: " .. idAttribute.TypeName) print(" - Value: " .. tostring(idAttribute.Value)) else print("Attribute 'SpecialID' was not found on the part.") end \`\`\` \*\*\* ### \*\*:GetFirstAttributeOfType(string: TypeName)\*\* Finds and returns the first attribute that matches the given type name. This is useful when you need to find data of a certain kind but don't care about its specific name. \*\*Parameters\*\* \* typeName (string): The case-sensitive type of the attribute to find (e.g., "Color3", "Vector3", "string"). \*\*Returns\*\* \* (table) The first attribute table found that matches the type. \* nil if no attributes of the specified type exist on the Instance. \*\*Example: Finding a Color Attribute\*\* This example finds the first Color3 attribute on a part, regardless of its name, and applies that color to the part itself. \`\`\`lua local testPart = game.Workspace.TestPart local colorAttribute = testPart:GetFirstAttributeOfType("Color3") if colorAttribute then print(string.format("Found a Color3 attribute named '%s'.", colorAttribute.Name)) -- The value is a Color3 object, which can be assigned directly testPart.Color = colorAttribute.Value print("Applied the attribute's color to the part.") else print("No Color3 attributes were found on this part.") end \`\`\` \*\*\* ### \*\*Attribute Data Types\*\* The .Value field of a returned Attribute Table can be one of several types. Here’s how to access the data for each TypeName. #### \*\*Primitive Types\*\* These are returned as standard Lua types. | TypeName | Lua Type | Description | | ---------- | -------- | ---------------------------------------------- | | string | string | A standard string of text. | | double | number | A floating-point number. Also used for Number. | | bool | boolean | A true or false value. | | BrickColor | integer | The numerical ID of a BrickColor. | \*\*Example\*\* \`\`\`lua local strAttr = part:GetAttribute("MyString") print(strAttr.Value) -- prints the string directly local numAttr = part:GetAttribute("MyNumber") print(numAttr.Value \* 2) -- Can be used in math \`\`\` #### \*\*Object Types\*\* These are returned as custom userdata objects or tables. \* \*\*Color3\*\* The .Value is a Color3 object. You can access its components with .R, .G, and .B. \`\`\`lua local colorAttr = part:GetFirstAttributeOfType("Color3") if colorAttr then -- The value is a Color3 object local r, g, b = colorAttr.Value.R, colorAttr.Value.G, colorAttr.Value.B print(string.format("Color: R=%.2f, G=%.2f, B=%.2f", r, g, b)) end \`\`\` \* \*\*Vector3\*\* The .Value is a Vector3 object with .X, .Y, and .Z components. \`\`\`lua local vectorAttr = part:GetAttribute("MyVector") if vectorAttr then local pos = vectorAttr.Value print("Position: " .. pos.X .. ", " .. pos.Y .. ", " .. pos.Z) end \`\`\` \* \*\*Vector2\*\* The .Value is a Lua table with .X and .Y number fields. \`\`\`lua local vector2Attr = part:GetAttribute("MyVector2") if vector2Attr then print(string.format("Vector2 Value: X=%d, Y=%d", vector2Attr.Value.X, vector2Attr.Value.Y)) end \`\`\` \* \*\*CoordinateFrame\*\* The .Value is a Lua table containing the CFrame's components, each being a Vector3 object. \`\`\`lua local cfAttr = part:GetFirstAttributeOfType("CoordinateFrame") if cfAttr then local cfValue = cfAttr.Value print("CFrame Position: " .. tostring(cfValue.Position)) print("CFrame LookVector: " .. tostring(cfValue.LookVector)) end \`\`\` \* \*\*Rect2D\*\* The .Value is a Lua table containing .Min and .Max fields, both of which are tables representing a 2D vector ({X, Y}). \`\`\`lua local rectAttr = part:GetFirstAttributeOfType("Rect2D") if rectAttr then local rect = rectAttr.Value print(string.format("Rect: Min(%d, %d), Max(%d, %d)", rect.Min.X, rect.Min.Y, rect.Max.X, rect.Max.Y)) end \`\`\` \* \*\*UDim\*\* The .Value is a Lua table with a .Scale (number) and .Offset (integer) field. \`\`\`lua local udimAttr = part:GetFirstAttributeOfType("UDim") if udimAttr then local udim = udimAttr.Value print(string.format("UDim: Scale=%.2f, Offset=%d", udim.Scale, udim.Offset)) end \`\`\` --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/game/attributes.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/overview/core-concepts.md). # Core Concepts

Event-Driven Callbacks

The scripting engine is event-driven. Instead of running your script in an infinite loop, you register functions to be called when specific events occur. This is more efficient and integrates cleanly with the application's lifecycle. \*\*\* {% hint style="info" %} You register a function using \`cheat.register()\`. {% endhint %}
Callback NameFrequencyDescription
onUpdate~5msFor logic that needs to run many times per second, like target finding or physics calculations.
onSlowUpdate~1sFor non-critical background tasks, like checking a value periodically or logging stats.
onPaintEvery Frame

(Most Common) All drawing must be done here. Use the

drawlibrary to draw to the screen.

\*\*\* \`\`\`lua local function my\_paint\_function() draw.rect(10, 10, 100, 100, 255, 0, 0, 255) end -- Register the function to be called by the engine cheat.reigster("onPaint", my\_paint\_function) \`\`\` --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/overview/core-concepts.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/product-guides/creating-a-simple-esp.md). # Creating a Simple ESP An ESP script is a great way to learn the fundamentals of the API. This guide will show you how to draw a box around every enemy player. \*\*\* This script uses three key components: 1. \`entity.GetPlayers()\`: To get a list of all players. 2. \`entity.IsEnemy()\` and \`entity.BoundingBox()\`: To check if a player is an enemy and get their screen position. 3. \`draw.Rect()\`: To draw the box. \*\*\* \`\`\`lua local function draw\_esp() -- Get a list of all enemy player objects local enemy\_players = entity.GetPlayers(true) for \_, player in ipairs(enemy\_players) do if player.IsAlive then -- Get the 2D bounding box from the player object's property local bbox = player.BoundingBox draw.Rect(bbox.x, bbox.y, bbox.w, bbox.h, Color3.fromRGB(255, 0, 0)) local name = player.Name local teamColor = player.TeamColor -- This is a Color3 object -- Calculate text size to center it local text\_width, text\_height = draw.GetTextSize(name, "Tahoma") local text\_x = bbox.x + (bbox.w / 2) - (text\_width / 2) local text\_y = bbox.y - text\_height - 2 -- Position text above the box draw.text(name, text\_x, text\_y, Color3.fromRGB(teamColor.R, teamColor.G, teamColor.B), "Tahoma", 255) -- Draw a health bar local health\_percent = player.Health / player.MaxHealth local bar\_width = 5 local bar\_height = bbox.h \* health\_percent local bar\_x = bbox.x - bar\_width - 2 local bar\_y = bbox.y + (bbox.h - bar\_height) draw.Rect(bar\_x, bbox.y, bar\_width, bbox.h, Color3.fromRGB(50, 0, 0)) draw.RectFilled(bar\_x, bar\_y, bar\_width, bar\_height, Color3.fromRGB(0, 255, 0)) end end end -- Register our function to the onPaint event cheat.register("onPaint", draw\_esp) \`\`\` --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/product-guides/creating-a-simple-esp.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/parts.md). # Parts {% hint style="info" %} These functions operate on an integer \`index\` which you get from \`entity.GetParts()\`. {% endhint %} #### GetParts() Returns a table of integer indices for all currently cached parts. \* table of number indices. \*\*\* #### getPartPosition(int: index) \*\*Returns:\*\* number, number, number - The X, Y, and Z world coordinates. \*\*\* #### getPartSize(int: index) \*\*Returns:\*\* number, number, number - The X, Y, and Z size. \*\*\* #### getPartRotation(int: index) Returns the part's rotation matrix as a flat table of 9 numbers. \*\*\* --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/entity/parts.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/game.md). # game #### Workspace \`\`\` game.Workspace \`\`\` Returns the Workspace instance. \*\*\* #### Players \`\`\` game.Players \`\`\` Returns the Players instance. \*\*\* #### DataModel \`\`\` game.DataModel \`\`\` Returns the DataModel instance. \*\*\* #### LocalPlayer \`\`\` game.LocalPlayer \`\`\` Returns the LocalPlayer instance. \*\*\* #### PlaceID \`\`\`lua if game.PlaceID == 12345678 then print("We are in the special testing place!") end \`\`\` The unique numerical ID of the current game or "place" you are in. --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/game.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/entity.md). # entity Unlike the \`game\` global which interacts with live game objects, the \`entity\` library works with a snapshot of data that is updated by the client at optimized intervals. \*\*\* --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/entity.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties.md). # Properties #### .Parent The direct parent of the object in the hierarchy. Setting this property to a new \`Instance\` will move the object. Setting it to \`nil\` will remove it from the game world. \`\`\`lua local part = game.Workspace.MyPart print("The parent of MyPart is", part.Parent.Name) -- "Workspace" -- Move the part to be a child of the character part.Parent = game.LocalPlayer.Character \`\`\` \*\*\* #### .Name The name of the object. \`\`\`lua local part = game.Workspace:FindFirstChild("Baseplate") print(part.Name) -- "Baseplate" part.Name = "NewBaseplate" \`\`\` \*\*\* #### .Character The character model currently controlled by the \`Player\`. This model contains the \`Humanoid\` and all body parts. This can be \`nil\` if the player has not spawned yet or their character has been destroyed. \`\`\`lua local character = game.LocalPlayer.Character if character then -- Character exists, find the Humanoid local humanoid = character:FindFirstChildOfClass("Humanoid") if humanoid then print("My health is:", humanoid.Health) end end \`\`\` \*\*\* #### .ClassName The specific class type of the object (e.g., "Part", "Humanoid", "Player"). \`\`\`lua for \_, child in ipairs(game.Workspace:GetChildren()) do print(child.Name, "is a", child.ClassName) end \`\`\` \*\*\* #### .Address The memory address of the object instance, represented as a hexadecimal string. Useful for a unique identifier. \`\`\`lua print("Workspace address:", game.Workspace.Address) \`\`\` \*\*\* #### .Color The RGB color of the Part, represented as a Color3 object. \`\`\`lua local myPart = game.GetWorkspace().MyPart -- Set the color to blue myPart.Color = Color3.new(0, 0, 255) -- Read the color back and check its components local currentColor = myPart.Color print("The red component is: " .. currentColor.R) \`\`\` \*\*\* #### .Material The name of the physical material of the object (e.g., "Plastic", "Metal", "Neon"). \`\`\`lua game.Workspace.MyPart.Material = "Neon" \`\`\` \*\*\* #### .Size The size of the Part's bounding box along its local X, Y, and Z axes, represented as a Vector3. \`\`\`lua local myPart = game.GetWorkspace().MyPart myPart.Size = Vector3.new(10, 10, 10) -- Read the size back local currentSize = myPart.Size print("The part's width (X size) is: " .. currentSize.X) \`\`\` \*\*\* #### .Value A generic property for getting or setting the value of "\*\*Value Objects" like StringValue, NumberValue, ObjectValue\*\*, etc. The type returned or accepted depends on the object's \*\*ClassName\*\*. \`\`\`lua local myStringValue = game.Workspace.MyStringValue print(myStringValue.Value) myStringValue.Value = "New Value" local myObjectValue = game.Workspace.MyObjectValue myObjectValue.Value = game.LocalPlayer.Character -- Set it to an Instance \`\`\` \*\*\* #### .SoundId The asset ID of the sound associated with this object, if any. \*\*\* #### .Position The 3D world coordinate of the Part's center, represented as a Vector3 object. \`\`\`lua local myPart = game.GetWorkspace().MyPart -- Get the position as a single Vector3 object local currentPos = myPart.Position print("The part's height (Y position) is: " .. currentPos.Y) -- To set the position, you must create a new Vector3 myPart.Position = Vector3.new(currentPos.X, currentPos.Y + 10, currentPos.Z) \`\`\` \*\*\* #### .Velocity The speed and direction the Part is moving, represented as a Vector3 in studs per second. \`\`\`lua local myPart = game.GetWorkspace().MyPart -- Make the part move upwards by setting its velocity with a Vector3 myPart.Velocity = Vector3.new(0, 100, 0) -- Read the velocity back local currentVelocity = myPart.Velocity print("Current upward speed is: " .. currentVelocity.Y) \`\`\` \*\*\* #### .CanCollide Returns a bool value of whether the BasePart has CanCollide enabled or not. Can be used to set Collide. \*\*\* #### .Transparency The transparency of the Part. A value of 0 is completely opaque, and 1 is completely invisible. \`\`\`lua -- Make the part semi-transparent game.Workspace.MyPart.Transparency = 0.5 \`\`\` \*\*\* #### .Reflectance How much the Part reflects its surroundings. A value of 0 is non-reflective (like matte plastic), and 1 is perfectly reflective (like a mirror). \`\`\`lua game.Workspace.MyPart.Reflectance = 1 \`\`\` \*\*\* #### .Rotation The orientation of the Part, represented as a Vector3. This property is \*\*read-only\*\*. \`\`\`lua local myPart = game.GetWorkspace().MyPart -- Get the rotation as a single Vector3 object local currentRotation = myPart.Rotation print(string.format("Current Y-axis rotation: %.2f", currentRotation.Y)) \`\`\` \*\*\* #### .LookVector A unit vector (length of 1) that points in the direction of the Part's \*\*front\*\* (-Z) face. It's a Vector3 Object. \*\*\* #### .RightVector A unit vector (length of 1) that points in the direction of the Part's \*\*right\*\* (+X) face. It's a Vector3 Object. \*\*\* #### .UpVector A unit vector (length of 1) that points in the direction of the Part's \*\*top\*\* (+Y) face. It's a Vector3 Object. \*\*\* #### .MeshId The asset ID for a custom mesh. \*\*\* #### .TextureId The asset ID for a texture applied to the Part. \*\*\* #### .DecalTextureId The asset ID for a decal applied to the Part. \*\*\* #### .SpecialMeshTextureId The asset ID for the texture of a SpecialMesh object inside the Part. \*\*\* #### .BonePosition The 3D position of a bone object. \*\*\* #### .ButtonPosition The 2D position of a button object. \*\*\* #### .ButtonSize The size of a button object. \*\*\* #### .VisibleFrame A property related to whether the frame is visible or not \*\*\* #### .HoldDuration The time in seconds a user must hold an interaction, typically for a ProximityPrompt. \*\*\* #### .MaxActivationDistance The maximum distance in studs from which a user can interact with this Part, typically for a ProximityPrompt. \*\*\* #### .ProximityActionText The text displayed to the user when they are able to interact with this Part (e.g., "Open", "Talk"). \*\*\* #### .ProximityExclusivity The exclusivity behavior of the ProximityPrompt (e.g., "OnePerButton"). \*\*\* #### .UserId The unique numerical ID associated with the player's account. \`\`\`lua print("My UserID is:", game.LocalPlayer.UserId) \`\`\` \*\*\* #### .Team The name of the Team the Player is currently on. \`\`\`lua if game.LocalPlayer.Team == "Red" then print("I'm on the Red team!") end \`\`\` \*\*\* \*\*.FramePosition\*\* A read-only property that returns the X and Y coordinates of a GUI element's position. \*\*\* \*\*.FrameBackgroundColor\*\* A read-only Color3 property that describes the background color of a GUI Frame. \*\*\* #### .\*\*FrameBorderColor\*\* A read-only Color3 property that describes the border color of a GUI Frame. \*\*\* #### .CameraMaxZoomDistance The maximum distance in studs the player can zoom their camera out. \`\`\`lua -- Allow the player to zoom out very far game.LocalPlayer.CameraMaxZoomDistance = 1000 \`\`\` \*\*\*

Humanoid

\`\`\`lua local my\_humanoid = game.LocalPlayer.Character.Humanoid local health\_percentage = (my\_humanoid.Health / my\_humanoid.MaxHealth) \* 100 print(string.format("I am at %.2f%% health.", health\_percentage)) \`\`\` \*\*\* #### .MaxHealth The maximum health of the Humanoid. \*\*\* #### .MoveDirection A unit vector representing the direction the Humanoid is currently moving, relative to the world. A vector of (0, 0, 0) means the Humanoid is standing still. \`\`\`lua local move\_dir\_x, move\_dir\_y, move\_dir\_z = game.LocalPlayer.Character.Humanoid.MoveDirection if move\_dir\_z < -0.5 then print("I am moving forward!") end \`\`\` \*\*\* #### .Health The health of the Humanoid. \*\*\* --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/game/properties.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/ui.md). # ui ### Core Functions These functions are used to interact with existing UI elements. #### ui.getValue Retrieves the current value of a specified UI widget. \`\`\`lua value = ui.getValue(tab\_ref, container\_ref, name) \`\`\` \*\*Parameters\*\* \* tab\\\_ref (string): The reference name of the tab the widget is in. \* container\\\_reef (string): The reference name of the container the widget is in. \* name (string): The name of the widget. \*\*Returns\*\* \* The current value of the widget. The type of the value depends on the widget (e.g., boolean for a checkbox, number for a slider, string for an input text). Returns \`nil\` if the widget is not found. #### ui.setValue Sets a new value for a specified UI widget. \`\`\`lua ui.setValue(tab\_ref, container\_ref, name, new\_value) \`\`\` \*\*Parameters\*\* \* tab\\\_ref, container\\\_ref, name: (string) - Identifiers for the target widget. \* new\\\_value (any): The new value to set. The type must match what the widget expects (e.g., boolean for a checkbox, number for a slider). \`\`\`lua -- Turn a checkbox off ui.setValue("Aimbot", "Aimbot", "Enabled", false) -- Set a slider's value ui.setValue("Aimbot", "Aimbot", "Smoothing", 95.5) -- Set a color picker's value using a table ui.setValue("Visuals", "Visuals", "Box Color", {r=255, g=0, b=0, a=255}) \`\`\` #### ui.setVisibility Shows or hides a specific UI widget. \`\`\`lua ui.setVisibility(tab\_ref, container\_ref, name, is\_visible) \`\`\` \*\*Parameters\*\* \* tab\\\_ref, container\\\_ref, name: (string) - Identifiers for the target widget. \* is\\\_visible (boolean): true to show the widget, false to hide it. \`\`\`lua -- Hide the smoothing slider if the aimbot is disabled local aimbot\_enabled = ui.getValue("Aimbot", "Aimbot", "Enabled") ui.setVisibility("Aimbot", "Aimbot", "Smoothing", aimbot\_enabled) \`\`\` \*\*\* ### Layout Elements These functions create the main structure of your UI. #### ui.newTab Creates a new top-level tab in the menu. \`\`\`lua ui.newTab(tab\_ref, display\_name) \`\`\` \*\*Parameters\*\* \* tab\\\_ref (string): A unique reference name for this tab (e.g., "my\\\_script\\\_tab"). \* display\\\_name (string): The text that will be displayed on the tab button (e.g., "My Script"). \`\`\`lua ui.newTab("my\_script\_main", "My Awesome Script") \`\`\` #### ui.newContainer Creates a new container (a column) within a specified tab. All widgets must be placed inside a container. \`\`\`lua ui.newContainer(tab\_ref, container\_ref, display\_name, \[options\]) \`\`\` \*\*Parameters\*\* \* tab\\\_ref (string): The reference name of the parent tab. \* container\\\_ref (string): A unique reference name for this container. \* display\\\_name (string): The title displayed at the top of the container. \* options (table, optional): A table of boolean flags to control layout: \* autosize (boolean): If true, the container's height will dynamically adjust to fit its content. \* next (boolean): If true, will make the next container get placed in the right column \* halfsize (boolean): If true, the container will take up half the width of a column (allowing for side-by-side containers). \* visible (boolean): Defaults to true. Set to false to create a hidden container. \`\`\`lua -- Create a full-height container in the left column ui.newContainer("my\_script\_main", "my\_script\_visuals", "Visuals") -- Create a second, auto-sizing container in the right column ui.newContainer("my\_script\_main", "my\_script\_misc", "Misc", { autosize = true, next = true }) \`\`\` \*\*\* ### UI Widgets These are the interactive elements you can add to a container. #### ui.newCheckbox Creates a standard checkbox. \* \*\*Value Type:\*\* boolean \`\`\`lua ui.newCheckbox(tab\_ref, container\_ref, name, \[in\_line\]) \`\`\` \*\*Parameters\*\* \* \`tab\_ref\`, \`container\_ref\`, \`name\`: (string) - Identifiers. \* \`in\_line\` (boolean, optional): If \`true\`, this checkbox will attempt to render on the same line as the previous element (useful for settings buttons). #### ui.newSliderInt Creates a slider for integer values. \* \*\*Value Type:\*\* \`number\` (integer) \*\*Signature\*\* \`\`\`lua ui.newSliderInt(tab\_ref, container\_ref, name, min, max, \[default\]) \`\`\` \*\*Parameters\*\* \* \`min\`, \`max\` (number): The minimum and maximum values for the slider. \* \`default\` (number, optional): The initial value of the slider. Defaults to \`min\`. #### ui.newSliderFloat Creates a slider for floating-point (decimal) values. \* \*\*Value Type:\*\* \`number\` (float) \*\*Signature\*\* \`\`\`lua ui.newSliderFloat(tab\_ref, container\_ref, name, min, max, \[default\]) \`\`\` #### ui.newDropdown Creates a dropdown menu for selecting one option from a list. \* \*\*Value Type:\*\* number (integer, 1-based index of the selected option) \`\`\`lua ui.newDropdown(tab\_ref, container\_ref, name, options\_table, \[default\_index\]) \`\`\` \*\*Parameters\*\* \* options\\\_table (table): An array of strings representing the options. \* default\\\_index (number, optional): The 1-based index of the option to be selected initially. Defaults to 1. #### ui.newMultiselect Creates a dropdown menu where multiple options can be selected at once. \* \*\*Value Type:\*\* table (an array of booleans) \`\`\`lua ui.newMultiselect(tab\_ref, container\_ref, name, options\_table) \`\`\` #### ui.newColorpicker Creates an interactive color picker. \* \*\*Value Type:\*\* table (e.g., {r=255, g=128, b=0, a=255}) \`\`\`lua ui.newColorpicker(tab\_ref, container\_ref, name, \[default\_color\], \[in\_line\]) \`\`\` \*\*Parameters\*\* \* default\\\_color (table, optional): A table with r, g, b, and a keys (0-255). \* in\\\_line (boolean, optional): If true, attempts to render on the same line. #### ui.newInputText Creates a text input field. \* \*\*Value Type:\*\* string \`\`\`lua ui.newInputText(tab\_ref, container\_ref, name, \[default\_text\]) \`\`\` #### ui.newButton Creates a clickable button that executes a Lua function. \`\`\`lua ui.newButton(tab\_ref, container\_ref, name, callback\_function) \`\`\` \*\*Parameters\*\* \* callback\\\_function (function): The Lua function to execute when the button is clicked. #### ui.newListbox Creates a listbox for selecting an item from a vertical list. \`\`\`lua ui.newListbox(tab\_ref, container\_ref, name, options\_table, \[callback\_function\]) \`\`\` \*\*Parameters\*\* \* options\\\_table (table): An array of strings to display in the list. \* callback\\\_function (function, optional): A Lua function that is executed whenever a new item is selected. \*\*\* ### Full Script Example This example creates a new tab with two containers and populates them with various UI elements. \`\`\`lua -- Create the main tab for our script ui.newTab("my\_script\_tab", "My ESP Script") -- Create a container for the main ESP settings in the left column, next makes the next container go to the right column ui.newContainer("my\_script\_tab", "esp\_settings", "ESP Settings", { autosize = true, next = true }) -- Add widgets to the first container ui.newCheckbox("my\_script\_tab", "esp\_settings", "Enable ESP") ui.newSliderFloat("my\_script\_tab", "esp\_settings", "Max Distance", 100.0, 2000.0, 500.0) ui.newDropdown("my\_script\_tab", "esp\_settings", "Box Style", { "Normal", "Cornered", "3D" }, 1) ui.newMultiselect("my\_script\_tab", "esp\_settings", "Flags", { "Health", "Distance", "Weapon" }) ui.newColorpicker("my\_script\_tab", "esp\_settings", "Box Color", {r=0, g=255, b=255, a=255}) ui.newContainer("my\_script\_tab", "misc\_settings", "Misc", { autosize = true }) -- Add widgets to the second container ui.newInputText("my\_script\_tab", "misc\_settings", "Custom Message", "Hello, World!") local function on\_button\_click() -- Use ui.getValue to make the UI interactive local is\_enabled = ui.getValue("my\_script\_tab", "esp\_settings", "Enable ESP") local message = ui.getValue("my\_script\_tab", "misc\_settings", "Custom Message") if is\_enabled then print("Button Clicked! Your message is: " .. message) else print("Button Clicked, but the ESP is disabled!") end end ui.newButton("my\_script\_tab", "misc\_settings", "Print Message", on\_button\_click) print("My custom UI script has been loaded!") \`\`\` --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/ui.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/game/functions.md). # Functions #### GetCameraPos \`\`\`lua game.CameraPosition \`\`\` Returns a vector3 object of the camera position. \* Vector3 \*\*\* #### GetService \`\`\`lua game.GetService(string: Service) \`\`\` \*\*\* #### SilentAim \`\`\`lua game.SilentAim(float: x, float: y) \`\`\` A function that takes screen coordinates as a parameter and will attempt to silent aim. \* x: number - The X screen coordinate to aim at. \* y: number - The Y screen coordinate to aim at. \*\*\* #### PlayerWhitelist \`\`\`lua game.PlayerWhitelist(name) \`\`\` Toggles the whitelist status for a player by their name. \* name: string - The username of the player to toggle. \*\*\* --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/game/functions.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/model.md). # Model This is useful for creating custom scripts for games with unique PVE elements or interactive environments. #### entity.AddModel(string: key, table: data) Adds a new model to the entity cache. If a model with the same \`key\` already exists, it will be overwritten. | Parameter | Type | Description | | --------- | -------- | ------------------------------------------------------------------------ | | \`key\` | \`string\` | A unique identifier for this model (e.g., \`"npc\_1"\`, \`"guard\_tower"\`). | | \`data\` | \`table\` | A table containing the model's properties (see Data Table Fields below). | \*\*Returns:\*\* \`boolean\` - \`true\` if successful. \*\*\* #### entity.RemoveModel(string: key) Removes a model from the entity cache using its unique key. | Parameter | Type | Description | | --------- | -------- | --------------------------------------------- | | \`key\` | \`string\` | The unique identifier of the model to remove. | \*\*Returns:\*\* \`boolean\` - \`true\` if a model was successfully removed. \*\*\* #### entity.ClearModels() Removes all custom models that were added via \`AddModel\`. This is useful for script cleanup or when changing places. \*\*Returns:\*\* \`boolean\` - \`true\` if successful. \*\*\*

Data Table Fields

The \`data\` table passed to \`AddModel\` and \`EditModel\` can contain the following fields:
FieldTypeRequiredDescription
CharacterInstanceYesThe Roblox Model instance to be tracked.
PrimaryPartInstanceYesThe root part of the model, used for positioning (e.g., HumanoidRootPart).
NamestringYesA name for the entity (e.g., "Guard", "Zombie").
DisplayNamestringNoA display name. If omitted, falls back to Name.
TeamstringNoThe team name for friendly/enemy checks.
WeaponstringNoThe name of the weapon the model is holding.
HumanoidHumanoidNoHumanoid Instance, will automatically be used to get health, max health, and move direction/player states.
HealthInstanceInstanceNo(Recommended) An instance of a NumberValue, or IntValue for dynamic, real-time health updates. If you added a Humanoid, you might not need this.
HealthnumberNoA static health value. This is only used if HealthInstance or Humanoidis not provided.
MaxHealthnumberNoThe maximum health. Required if using static Health or a NumberValue/IntValue.
\*\*\*

Examples

{% hint style="info" %} This example adds an NPC with a \`Humanoid\` object. The API will automatically track its health, max health, and velocity in real-time. {% endhint %} \`\`\`lua local npc\_model = game.Workspace:FindFirstChild("GuardNPC") if npc\_model and npc\_model:IsA("Model") then local humanoid = npc\_model:FindFirstChildOfClass("Humanoid") if humanoid then local npc\_data = { Character = npc\_model, PrimaryPart = npc\_model.PrimaryPart or npc\_model.Head, Name = "GuardNPC", DisplayName = "Castle Guard", Team = "CastleDefenders", Humanoid = humanoid -- The API will handle everything from here } -- add the NPC with a unique key entity.AddModel("guard\_1", npc\_data) end end -- profit \`\`\` \*\*\* {% hint style="info" %} This example adds a "turret" with static health. It won't update automatically, so you must use EditModel to change its health. This is ideal for objects without a Humanoid or NumberValue. {% endhint %} \`\`\`lua local turret = game.Workspace:FindFirstChild("Turret") if turret then local turret\_data = { Character = turret, PrimaryPart = turret.Base, Name = "AutoTurret", Team = "Red", Health = 500, MaxHealth = 500 } entity.AddModel("turret\_alpha", turret\_data) end -- To update its health after it takes damage: -- entity.EditModel("turret\_alpha", { Health = 400 }) \`\`\` --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/entity/model.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/http.md). # http \*\*http.Get(string: url, table: headers, function: callback)\*\* Performs an asynchronous HTTP GET request. \* \*\*url\*\*: The URL to send the request to. \* \*\*headers\*\*: A table of request headers (e.g., {\\\["Content-Type"\] = "application/json"}). \* \*\*callback\*\*: A function to be called with the response body (as a string) when the request is complete. \`\`\`lua local headers = { \["Accept"\] = "\*/\*", \["User-Agent"\] = "MySuperSecureClient/1.0" } http.Get("https://api.example.com/data", headers, function(response) if response then print("Received data:", response) else print("The request failed.") end end) \`\`\` \*\*http.Post(string: url, table: headers, string: body, function: callback)\*\* Performs an asynchronous HTTP POST request. \* \*\*url\*\*: The URL to send the request to. \* \*\*headers\*\*: A table of request headers. \* \*\*body\*\*: The string data to send in the request body. \* \*\*callback\*\*: A function to be called with the response body (as a string) when the request is complete. \`\`\`lua local headers = { \["Content-Type"\] = "application/json" } local json\_body = '{"username": "MyUser", "score": 100}' http.Post("https://api.example.com/submit", headers, json\_body, function(response) if response then print("Server responded:", response) else print("The POST request failed.") end end) \`\`\` --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/http.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/vector3-and-color3-example.md). # Vector3 & Color3 Example \`\`\`lua local myPart = game.Workspace.MyPart -- make the part a semi-transparent, reflective, red cube that flies up myPart.Size = Vector3.new(10, 10, 10) myPart.Color = Color3.new(255, 0, 0) myPart.Transparency = 0.5 myPart.Reflectance = 0.8 myPart.Velocity = Vector3.new(0, 50, 0) \`\`\` --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/vector3-and-color3-example.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # What is this? | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/overview/what-is-this.md) . The Serotonin scripting engine allows you to write `.lua` files to modify your game experience. It's built on LuaJIT for maximum performance and uses a modern C++ wrapper to expose a safe and easy-to-use API. * * * * **Performance:** Scripts run in a high-performance Just-In-Time compiled environment. * **Security:** The API is designed to be safe, with restricted access to the filesystem and network by default. * **Ease of Use:** A clean, object-oriented API with clear naming conventions lets you focus on logic instead of boilerplate. [PreviousSerotonin Lua Documentation](https://serotonin-1.gitbook.io/serotonin-docs) [NextCore Concepts](https://serotonin-1.gitbook.io/serotonin-docs/overview/core-concepts) Last updated 1 year ago --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/game/methods.md). # Methods #### :GetChildren() Returns a table containing all of the direct children of the Instance. \`\`\`lua for \_, child in ipairs(game.Workspace:GetChildren()) do print(child.Name) end \`\`\` \*\*\* #### :IsA(string: className) checks if the instance is of the same Class as the className \*\*\* #### :GetDescendants() Returns a table containing all objects parented to the Instance at any depth (children, children's children, etc.). \`\`\`lua for \_, descendant in ipairs(game.Workspace:GetDescendants()) do if descendant.ClassName == "Humanoid" then print("Found a humanoid:", descendant.Parent.Name) end end \`\`\` \*\*\* #### :FindFirstChild(string: name) Searches for a direct child with the given name. This is faster than iterating through :GetChildren(). \`\`\`lua local camera = game.Workspace:FindFirstChild("Camera") if camera then -- do something end \`\`\` \*\*\* #### :FindFirstChildOfClass(string: className) Searches for a direct child with the given ClassName. \`\`\`lua local humanoid = game.LocalPlayer.Character:FindFirstChildOfClass("Humanoid") \`\`\` \*\*\* #### :\*\*IsDescendantOf\*\*(\*\*Instance: ancestor)\*\* Checks if the instance is a descendant of the specified ancestor object. This means it is a child, a child of a child, and so on \`\`\`lua local part = game.Workspace.MyCharacter.Head local character = game.Workspace.MyCharacter if part:IsDescendantOf(character) then print("The Head is a descendant of the Character.") end \`\`\` \*\*\* #### :\*\*IsAncestorOf(Instance: descendant)\*\* Checks if the instance is an ancestor of the specified descendant object. This is the reverse of :IsDescendantOf(). \`\`\`lua local character = game.Workspace.MyCharacter local rightHand = character.RightHand if character:IsAncestorOf(rightHand) then print("The Character is an ancestor of the RightHand.") end \`\`\` \*\*\* \*\*:FindFirstAncestor(string: name)\*\* Searches up the hierarchy from the instance's parent and returns the first ancestor found with the given name. If no ancestor is found, it returns nil. \`\`\`lua local enginePart = game.Workspace.MyCar.Engine.EngineBlock local carModel = enginePart:FindFirstAncestor("MyCar") if carModel then print("Found the car model:", carModel.Name) end \`\`\` \*\*\* \*\*:FindFirstAncestorOfClass(string: className)\*\* Searches up the hierarchy and returns the first ancestor that is of the specified class. \`\`\`lua local humanoid = game.LocalPlayer.Character.Head:FindFirstAncestorOfClass("Humanoid") if humanoid then print("Found the humanoid by searching up from the Head.") end \`\`\` \*\*\* #### :\*\*FindFirstDescendant(string: name)\*\* Searches through all descendants of an instance and returns the first one found with the given name. This is useful for finding a specific part without knowing its exact location. \`\`\`lua local character = game.LocalPlayer.Character local specialPart = character:FindFirstDescendant("EffectPart") if specialPart then print("Found the effect part somewhere in the character model.") end \`\`\` \*\*\* \*\*:FindFirstDescendantOfClass(string: className)\*\* Searches through all descendants of an instance and returns the first one found with the specified ClassName. \`\`\`lua local player = game.Players.LocalPlayer local a\_humanoid = player:FindFirstDescendantOfClass("Humanoid") if a\_humanoid then print("Found a humanoid within the player instance!") end \`\`\` \*\*\* #### :SetHighlightOnTop() Makes the Highlight Instance render on top of walls. \*\*\* #### :SetHighlightTransparency(float: transparency) Sets the transparency of the highlight effect. \*\*\* --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/game/methods.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/utility.md). # utility utility.RandomInt(min, max) Returns a random integer between min and max (inclusive). #### utility.RandomFloat(min, max) Returns a random floating-point number between min and max. #### utility.GetTickCount() Returns the number of milliseconds that have elapsed since the system was started. \*\*Returns:\*\* \* number \*\*utility.GetFingerprint()\*\* Returns a unique hardware identifier (fingerprint) for the current user. \*\*utility.SetClipboard(string: content)\*\* Sets the system clipboard to the specified text content. \`\`\`lua utility.SetClipboard("This text is now in the clipboard!") \`\`\` \*\*utility.GetClipboard()\*\* Returns the current text content from the system clipboard as a string. \*\*utility.MoveMouse(integer: dx, integer: dy)\*\* Moves the mouse cursor relative to its current position. \* \*\*dx\*\*: The number of pixels to move horizontally (positive is right, negative is left). \* \*\*dy\*\*: The number of pixels to move vertically (positive is down, negative is up). \`\`\`lua -- Move the mouse 50 pixels to the right and 20 pixels up utility.MoveMouse(50, -20) \`\`\` #### utility.GetDeltaTime() Returns the time in seconds it took to complete the last frame. Useful for framerate-independent animations. \*\*Returns:\*\* \* number #### utility.GetMousePos() Returns the mouse position. \*\*Returns:\*\* \* vector2 table #### utility.GetMenuState() Returns the menu state. \*\*Returns:\*\* \* boolean #### utility.WorldToScreen(Vector3: object) Converts a Vector3 object of coordinates into a 2D screen coordinate. \*\*Returns:\*\* \* screenX: number - The X coordinate on the screen. \* screenY: number - The Y coordinate on the screen. \* onScreen: boolean - true if the point is within the visible screen area. \*\*\* \`\`\`lua local part = game.Workspace.MyPart local part\_position\_vector = part.Position -- This is a Vector3 object local sx, sy, is\_on\_screen = utility.world\_to\_screen(part\_position\_vector) if is\_on\_screen then draw.text("Here!", sx, sy, Color3.new(1, 1, 1)) end \`\`\` \*\*\* #### LoadImage Loads raw image data (e.g., from a .png or .jpg file) into a GPU texture and returns a handle to it. This handle is then used by draw\\.Image. \* \*\*Aliases:\*\* utility.LoadImage, utility.loadImage, utility.load\\\_image \* \*\*Signature:\*\* utility.LoadImage(image\\\_data) \* \*\*Parameters:\*\* \* image\\\_data: string - The raw binary content of an image file, typically read using file.read(). \* \*\*Returns:\*\* integer - A unique texture ID to be used with draw\\.Image. Returns nil or throws an error on failure. \* \*\*Example:\*\* Generated lua \`\`\`lua local image\_data = file.read("my\_logo.png") if image\_data then local logo\_texture\_id = utility.load\_image(image\_data) if logo\_texture\_id then cheat.register("onPaint", function() draw.image(logo\_texture\_id, 50, 50, 100, 100, 255, 255, 255, 255) end) end end \`\`\` --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/utility.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players.md). # Players #### GetPlayers(\\\[onlyEnemies\]) Returns a table containing the integer indices of all currently cached players. \*\*Parameters:\*\* \* \`onlyEnemies: boolean\` (optional) - If \`true\`, only returns indices of players who are on an enemy team. Defaults to \`false\`. \`\`\`lua -- Get all players local all\_players = entity.GetPlayers() -- Get only enemies local enemy\_players = entity.GetPlayers(true) print("Total players:", #all\_players) print("Total enemies:", #enemy\_players) \`\`\` \*\*\* #### GetLocalPlayer() Returns the index of the local player. \*\*\* #### .Name \*\*Returns:\*\* string - The player's username. \*\*\* #### .DisplayName \*\*Returns:\*\* string - The player's display name. \*\*\* #### .UserId \*\*Returns:\*\* number - The player's unique UserID. \*\*\* #### .Team \*\*Returns:\*\* string - The name of the player's team. \*\*\* #### .Weapon \*\*Returns:\*\* string - The name of the weapon the player is currently holding. \*\*\* #### .Position The 3D world position of the player's position. (Vector3 Object) \*\*\* #### .Velocity The current velocity of the player as a Vector3. \*\*\* #### .Health \*\*Returns:\*\* number - The player's current health. \*\*\* #### .MaxHealth \*\*Returns:\*\* number - The player's maximum health. \*\*\* #### .IsAlive \*\*Returns:\*\* boolean - true if the player's health is greater than 0. \*\*\* #### .IsEnemy \*\*Returns:\*\* boolean - true if the player is on an opposing team. \*\*\* #### .IsVisible \*\*Returns:\*\* boolean - true if the player is visible (not occluded by walls). \*\*\* #### .IsWhitelisted \*\*Returns:\*\* boolean - true if the player is on the global player whitelist. \*\*\* #### .BoundingBox A table with .x, .y, .w, .h fields for the 2D screen-space bounding box. \* x: number, y: number - The top-left corner of the box. \* w: number, h: number - The width and height of the box. \*\*\* #### .TeamColor The Color3 object representing the player's team color. \*\*\* #### :GetBonePosition(string: boneName) Returns the 3D world position of a specific bone as a Vector3 object. boneName is a string (e.g., "Head", "HumanoidRootPart"). \*\*\* #### :GetBoneInstance(string: boneName) Returns the actual Part Instance of a specific bone, which you can then manipulate with the game API. \*\*\* \*\*:GetBoneSize(boneName)\*\* Returns the size of a specific bone. \* \*\*Parameters:\*\* \* boneName: string - The name of the bone. \* \*\*Returns:\*\* \* Vector3 - The size of the bone, or nil if not found. \*\*\* \*\*:GetBoneRotation(boneName)\*\* Returns the rotation of a specific bone as a 3x3 matrix. \* \*\*Parameters:\*\* \* boneName: string - The name of the bone. \* \*\*Returns:\*\* \* table - An array-like table with 9 number elements representing the rotation matrix, or nil if not found. \*\*\*

Example for Bone Methods

\`\`\`lua local localplayer = entity.GetLocalPlayer() if not localplayer then return end local head\_instance = localplayer:GetBoneInstance("Head") local head\_pos = localplayer:GetBonePosition("Head") local head\_size = localplayer:GetBoneSize("Head") if head\_instance then local corners = draw.GetPartCorners(head\_instance) -- you can now draw the corners, refer to the drawing API to see how -- to go from here end if head\_pos and head\_size then print("Head is at " .. head\_pos.x .. " and is " .. head\_size.y .. " studs tall.") end \`\`\` --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/entity/players.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/cheat.md). # cheat ### Methods #### \`cheat.register(eventName, function)\` Registers a function to be called when a specific event occurs. This is the foundation of event-driven scripting in Serotonin. \*\*Parameters:\*\* \* \`eventName: string\` - The name of the event to hook into. \* \`function: function\` - The function to be executed when the event fires. \*\*Available Events:\*\* | Event Name | Description | | -------------- | ---------------------------------------------------------------------------- | | \`onUpdate\` | Fired at a very high frequency (\\~5ms). Ideal for game logic and fast loops. | | \`onSlowUpdate\` | Fired at a low frequency (\\~1s). Ideal for non-critical background tasks. | | \`onPaint\` | Fired every rendering frame. \*\*All drawing must be done here.\*\* | | \`shutdown\` | Fired when a script is unloaded. | | \`newPlace\` | Fired when a place change is detected. | \*\*Example:\*\* \`\`\`lua local function my\_paint\_function() draw.rect(10, 10, 50, 50, 255, 255, 255, 255) end -- Tell the engine to call our function every frame cheat.register("onPaint", my\_paint\_function) \`\`\` \*\*\* #### cheat.getWindowSize() Returns the width and height of the main game window in pixels. \*\*Returns:\*\* \* width: number - The width of the window. \* height: number - The height of the window. \`\`\`lua local screen\_w, screen\_h = cheat.getWindowSize() -- Calculate the center of the screen local center\_x = screen\_w / 2 local center\_y = screen\_h / 2 -- Draw a crosshair at the center draw.line(center\_x - 10, center\_y, center\_x + 10, center\_y, 255, 255, 255, 255, 1) draw.line(center\_x, center\_y - 10, center\_x, center\_y + 10, 255, 255, 255, 255, 1) \`\`\` \*\*\* --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/cheat.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/audio.md). # audio \*\*\* #### audio.playSound Plays a sound from a \`.wav\` file. \*\*Parameters\*\* \* \`wav\_data\` (\*\*string\*\*): The raw binary content of the \`.wav\` file, typically read using \`file.read()\`. \* \`loop\` (\*\*boolean\*\*, \*optional\*): If \`true\`, the sound will loop indefinitely until stopped by \`audio.stopAll()\`. \* \`volume\` (\*\*number\*\*, \*optional\*): The playback volume. \`1.0\` is normal volume. \`0.0\` is silent. Values can go up to \`2.0\`. Defaults to \`1.0\`. \* \`pitch\` (\*\*number\*\*, \*optional\*): The frequency multiplier for the sound's pitch. \`1.0\` is the original pitch. \`0.5\` is one octave lower, \`2.0\` is one octave higher. Defaults to \`1.0\`. \`\`\`lua local my\_sound = file.read("explosion.wav") if my\_sound then -- Play the sound once at 75% volume and a slightly higher pitch audio.playSound(my\_sound, false, 0.75, 1.1) end \`\`\` \*\*\* #### audio.beep Generates and plays a simple sine wave beep sound. This is useful for notifications or debugging. \*\*Parameters\*\* \* frequency (\*\*integer\*\*): The frequency of the beep in hertz (Hz). A standard 'A' note is 440Hz. \* duration (\*\*integer\*\*): The duration of the beep in milliseconds (ms). \`\`\`lua -- Play a short, high-pitched notification beep audio.beep(880, 200) \`\`\` \*\*\* #### audio.stopAll Immediately stops all sounds that were started with loop = true. One-shot sounds that are already finished are unaffected. \*\*Parameters\*\* None. \`\`\`lua -- Start some looping background music local music\_data = file.read("music.wav") if music\_data then audio.playSound(music\_data, true, 0.5) end audio.stopAll() \`\`\` \*\*\* ### Full Script Example This example creates a UI with sliders and buttons to test all functions of the audio library. You need to use ur own test\\\_sound.wav file. \`\`\`lua ui.newTab("Audio", "Audio Controls") ui.newContainer("Audio", "SoundControls", "Sound Controls", { halfsize = true, next = true }) ui.newContainer("Audio", "MiscControls", "Miscellaneous", { halfsize = true }) local sound\_data = file.read("test\_sound.wav") if not sound\_data then return end local volume\_ref = ui.newSliderFloat("Audio", "SoundControls", "Volume", 0.0, 2.0, 1.0) local pitch\_ref = ui.newSliderFloat("Audio", "SoundControls", "Pitch", 0.1, 2.0, 1.0) ui.newButton("Audio", "SoundControls", "Play One-Shot Sound", function() local vol = ui.getValue(volume\_ref) local pitch = ui.getValue(pitch\_ref) print("Playing sound with Volume: " .. vol .. ", Pitch: " .. pitch) audio.playSound(sound\_data, false, vol, pitch) end) local is\_music\_playing = false ui.newButton("Audio", "SoundControls", "Play/Stop Looping Music", function() if is\_music\_playing then audio.stopAll() is\_music\_playing = false else local vol = ui.getValue(volume\_ref) local pitch = ui.getValue(pitch\_ref) audio.playSound(sound\_data, true, vol, pitch) is\_music\_playing = true end end) ui.newButton("Audio", "MiscControls", "Play Beep (440Hz)", function() audio.beep(440, 500) end) ui.newButton("Audio", "MiscControls", "STOP ALL SOUNDS", function() audio.stopAll() is\_music\_playing = false end) \`\`\` --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/audio.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/color3.md). # Color3 {% hint style="info" %} Unlike the standard Roblox API, this implementation of Color3 is \*\*mutable\*\*. You can change its R, G, and B components directly. Values will be automatically clamped to the valid 0.0 to 1.0 range. {% endhint %} \`\`\`lua local skyColor = Color3.new(0.5, 0.7, 1.0) print(skyColor) skyColor.R = 0 -- or "r", case doesn't matter print(skyColor) \`\`\` #### Constructor \*\*Color3.new(r, g, b)\*\* Creates a new Color3 object. \* \*\*r\*\*: (Optional) number - Red component (0-1). Defaults to 1.0. \* \*\*g\*\*: (Optional) number - Green component (0-1). Defaults to 1.0. \* \*\*b\*\*: (Optional) number - Blue component (0-1). Defaults to 1.0. #### Properties | Property | Type | Description | | -------- | ------ | ------------------------------------------------- | | .R | number | \*\*(Read-Only)\*\* The red component of the color. | | .G | number | \*\*(Read-Only)\*\* The green component of the color. | | .B | number | \*\*(Read-Only)\*\* The blue component of the color. | \`\`\`lua local green = Color3.new(0, 1, 0) \`\`\` \*\*\* \*\*Color3.fromRGB(r, g, b)\*\* Creates a Color3 from components in the range \*\*0 to 255\*\*. \* \*\*r\*\*: (Optional) number - Red component (0-255). Defaults to 255. \* \*\*g\*\*: (Optional) number - Green component (0-255). Defaults to 255. \* \*\*b\*\*: (Optional) number - Blue component (0-255). Defaults to 255. \`\`\`lua local red = Color3.fromRGB(255, 0, 0) local dark\_grey = Color3.fromRGB(50, 50, 50) \`\`\` \*\*\* \*\*Color3.fromHSV(h, s, v)\*\* Creates a Color3 from Hue, Saturation, and Value components (0-1). \* \*\*h\*\*: number - Hue component (0-1). \* \*\*s\*\*: number - Saturation component (0-1). \* \*\*v\*\*: number - Value component (0-1). \`\`\`lua local pink = Color3.fromHSV(0.9, 0.8, 1.0) \`\`\` \*\*\* \*\*Color3.fromHex(hexString)\*\*\\ Creates a Color3 from a hex color code string (e.g., "#FF00FF"). The leading # is optional. \* \*\*hexString\*\*: string - The 6-digit hex code. \`\`\`lua local purple = Color3.fromHex("#8A2BE2") \`\`\` \*\*\*

Properties

| Property | Type | Description | Access | | -------- | ------ | --------------------------------------- | ---------- | | .R | number | The red component of the color (0-1). | Read/Write | | .G | number | The green component of the color (0-1). | Read/Write | | .B | number | The blue component of the color (0-1). | Read/Write | \*\*\*

Methods

\*\*color:Lerp(goalColor3, alpha)\*\* -> Color3\\ Returns a new Color3 linearly interpolated between the two colors by alpha (0.0 to 1.0). \*\*color:ToHSV()\*\* -> (h, s, v)\\ Returns the Hue, Saturation, and Value of the color as three separate number values (0-1). \`\`\`lua local c = Color3.fromRGB(255, 128, 0) local h, s, v = c:ToHSV() print(h, s, v) \`\`\` \*\*color:ToHex()\*\* -> string\\ Returns the 6-digit hex code string for the color, prefixed with #. \`\`\`lua local c = Color3.new(1, 0, 1) print(c:ToHex()) --> #FF00FF \`\`\` --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/color3.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/vector3.md). # Vector3 {% hint style="info" %} Unlike the standard Roblox API, this implementation of Vector3 is \*\*mutable\*\*. This means you can change its components directly after creation. {% endhint %} \`\`\`lua local pos = Vector3.new(10, 20, 30) print(pos) --> 10, 20, 30 pos.X = 99 -- or x, case doesn't matter print(pos) --> 99, 20, 30 \`\`\` #### Constructor \*\*Vector3.new(x, y, z)\*\* Creates a new Vector3 object. \* x: (Optional) number - The X component. Defaults to 0. \* y: (Optional) number - The Y component. Defaults to 0. \* z: (Optional) number - The Z component. Defaults to 0. | .X | number | \*\*(Read-Only)\*\* The X component of the vector. | | -- | ------ | ---------------------------------------------- | | .Y | number | \*\*(Read-Only)\*\* The Y component of the vector. | | .Z | number | \*\*(Read-Only)\*\* The Z component of the vector. | \`\`\`lua local startPosition = Vector3.new(0, 50, 0) local direction = Vector3.new(1, 0, 1) \`\`\` \*\*\*

Properties

| Property | Type | Description | Access | | ---------- | ------- | ----------------------------------------------------------- | ---------- | | .X | number | The X component of the vector. | Read/Write | | .Y | number | The Y component of the vector. | Read/Write | | .Z | number | The Z component of the vector. | Read/Write | | .Magnitude | number | The length (magnitude) of the vector. | Read-Only | | .Unit | Vector3 | A new Vector3 with the same direction but a magnitude of 1. | Read-Only | \*\*\*

Methods

{% hint style="info" %} Note: Methods that return a Vector3 create a \*\*new\*\* vector and do not modify the original. {% endhint %} \*\*vector:Abs()\*\* -> Vector3\\ Returns a new vector with the absolute values of each component. \*\*vector:Ceil()\*\* -> Vector3\\ Returns a new vector with each component rounded up to the nearest integer. \*\*vector:Floor()\*\* -> Vector3\\ Returns a new vector with each component rounded down to the nearest integer. \*\*vector:Sign()\*\* -> Vector3\\ Returns a new vector with the sign (-1, 0, or 1) of each component. \*\*vector:Cross(otherVector3)\*\* -> Vector3\\ Returns the cross product of the two vectors. \*\*vector:Dot(otherVector3)\*\* -> number\\ Returns the scalar dot product of the two vectors. \*\*vector:Lerp(goalVector3, alpha)\*\* -> Vector3\\ Returns a Vector3 linearly interpolated between the two vectors by alpha (0.0 to 1.0). \*\*vector:Angle(otherVector3, \\\[axisVector3\])\*\* -> number\\ Returns the angle in radians between two vectors. If axis is provided, the sign of the angle is determined relative to it. \*\*vector:FuzzyEq(otherVector3, \\\[epsilon\])\*\* -> boolean\\ Returns true if the two vectors are approximately equal. \*\*vector:Max(otherVector3)\*\* -> Vector3\\ Returns a new Vector3 with the highest components from both vectors. \*\*vector:Min(otherVector3)\*\* -> Vector3\\ Returns a new Vector3 with the lowest components from both vectors. --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/vector3.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/memory.md). # memory {% hint style="danger" %} \*\*IMPORTANT:\*\* Direct memory manipulation is a powerful but advanced feature. Incorrect usage, such as writing to the wrong address or using an incorrect data type, can easily cause the game client to crash. Use these functions with caution. {% endhint %} #### \*\*Supported Data Types\*\* The type parameter in memory.Read and memory.Write accepts the following case-insensitive strings:
Type StringC++ TypeLua TypeNotes
"float"floatnumber
"double"doublenumber
"int"int32\_tnumber32-bit signed integer
"uint"uint32\_tnumber32-bit unsigned integer
"bool"boolboolean
"byte"uint8\_tnumber8-bit unsigned integer
"short"int16\_tnumber16-bit signed integer
"ushort"uint16\_tnumber16-bit unsigned integer
"int64"int64\_tnumber64-bit signed integer
"uint64"uint64\_tnumber64-bit unsigned integer
"pointer" / "ptr"uintptr\_tnumberA memory address
"string"char\[\]stringReads/writes a standard C-style string
"vector2"vector2Vector2
"vector3"vectorVector3
"color3"vectorColor3Stored as a Vector3 in memory
"cframe"CFrametableRead-only
\*\*\* #### \*\*memory.Read\*\* Reads a value of a specified data type from a given memory address. > \`\`\`lua > memory.Read(type, address) > \`\`\` \*\*Parameters:\*\* \* \*\*type\*\* (string): The data type to read. See the supported data types table above. \* \*\*address\*\* (number): The raw memory address to read from. \*\*Returns:\*\* \* (any): The value read from memory, converted to the appropriate Lua type, or nil on failure. \`\`\`lua local local\_player = game.LocalPlayer local character = local\_player and local\_player.Character local humanoid = character and character:FindFirstChild("Humanoid") if humanoid then local humanoid\_addr = humanoid.Address -- Offset for WalkSpeed local walkspeed\_addr = humanoid\_addr + 0x1d4 local current\_speed = memory.Read("float", walkspeed\_addr) print("Current WalkSpeed from memory:", current\_speed) end \`\`\` \*\*\* #### \*\*memory.Write\*\* Writes a new value to a specified memory address. > \`\`\`lua > memory.Write(type, address, value) > \`\`\` \*\*Parameters:\*\* \* \*\*type\*\* (string): The data type to write. \* \*\*address\*\* (number): The raw memory address to write to. \* \*\*value\*\* (any): The new value to write. The type of this value must match the type parameter. \*\*Returns:\*\* \* (nil) \`\`\`lua local humanoid = game.LocalPlayer.Character and game.LocalPlayer.Character.Humanoid if humanoid then local humanoid\_addr = humanoid.Address -- Offset for HipHeight local hipheight\_addr = humanoid\_addr + 0x1a0 -- Write a new float value to the address memory.Write("float", hipheight\_addr, 5.0) end \`\`\` \*\*\* #### \*\*memory.GetBase\*\* Retrieves the base address of the main game module. > \`\`\`lua > memory.GetBase() > \`\`\` \*\*Returns:\*\* \* (number): The base address of the RobloxPlayerBeta.exe module. \*\*\* #### \*\*memory.Rebase\*\* A utility function to calculate an address by adding an offset to the game's base address. This is useful for static addresses. > \`\`\`lua > memory.Rebase(offset) > \`\`\` \*\*Parameters:\*\* \* \*\*offset\*\* (number): The offset to add to the base address. \*\*Returns:\*\* \* (number): The resulting rebased address. --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/memory.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. --- # Setting Up | Serotonin Docs For the complete documentation index, see [llms.txt](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt) . This page is also available as [Markdown](https://serotonin-1.gitbook.io/serotonin-docs/product-guides/setting-up.md) . 🛠️ Setting Up Your First Script 1\. Create a Lua File Create a new text file and save it with a `.lua` extension (e.g., `my-first-script.lua`). #### [](https://serotonin-1.gitbook.io/serotonin-docs/product-guides#id-2.-place-it-in-the-scripts-folder) 2\. Place it in the Scripts Folder Find the Serotonin data folder on your computer and place your new `.lua` file inside the `scripts` subdirectory. You can use the "Open Scripts Folder" button in the menu's Scripting tab to get there quickly. #### [](https://serotonin-1.gitbook.io/serotonin-docs/product-guides#id-3.-write-your-code) 3\. Write Your Code Open the file in a text editor (like VS Code, Notepad++, or Sublime Text) and write your script. A simple "Hello, World!" script looks like this: * * * Copy print("Hello from my first script!") -- Draw a green square on the screen local function draw_square() draw.rect(500, 500, 50, 50, 0, 255, 0, 255) end -- Register our drawing function to the onPaint event cheat.register("onPaint", draw_square) * * * #### [](https://serotonin-1.gitbook.io/serotonin-docs/product-guides#id-4.-load-the-script) 4\. Load the Script In the Serotonin menu, navigate to the **Scripting** tab. Your new script should appear in the list. 1. Click on your script's name in the listbox. 2. Click the **"Load"** button. You should now see the message in the console and a green square on your screen! [PreviousCore Concepts](https://serotonin-1.gitbook.io/serotonin-docs/overview/core-concepts) [Next Creating a Simple ESP](https://serotonin-1.gitbook.io/serotonin-docs/product-guides/creating-a-simple-esp) Last updated 1 year ago --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://serotonin-1.gitbook.io/serotonin-docs/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://serotonin-1.gitbook.io/serotonin-docs/api/file.md). # file #### Important Notes: \* \*\*Security and Sandbox:\*\* For security, all file operations are sandboxed and restricted to a specific sub-folder within your main application directory, typically named files/. You \*\*cannot\*\* use this API to read files from arbitrary locations on the user's computer (e.g., C:\\Windows\\system32.dll). \* \*\*Path Separators:\*\* Always use a forward slash (/) for directory separators in your paths, even on Windows. The C++ backend will handle the conversion correctly. Example: "configs/my\\\_settings.json". \* \*\*Naming Conventions:\*\* All functions support PascalCase, camelCase, and snake\\\_case. \*\*\* #### Loading a Custom Logo Draw an example logo over enemies using their bounding box. This uses the read function, utility LoadImage function, and draw\\.Image.
local LogoESP = {
    textureId = nil,
    isInitialized = false
}


function LogoESP:Initialize()
    local success, result = pcall(function()

        if not (file and file.read) then
            print("\[LogoESP\] Error: 'file.read' API is not available. Cannot load image.")
            return nil
        end

        local imageData = file.read("test\_logo.png")
        if not imageData then
            return nil
        end
        
        return utility.loadImage(imageData)
    end)

    if success and result then
        self.textureId = result
        self.isInitialized = true
    else
        print("\[LogoESP\] Initialization failed.")
        if not success then
            print("  -> Error details:", result)
        end
    end
end


function LogoESP:OnPaint()
    if not self.isInitialized or not self.textureId then
        return
    end

    local only\_enemies = false
    local players = entity.getPlayers(only\_enemies)


    for i, player in ipairs(players) do
        local bbox = player.BoundingBox
        

        if bbox then
            draw.image(self.textureId, bbox.x, bbox.y, bbox.w, bbox.h, 255, 255, 255, 255)
        end
    end
end

LogoESP:Initialize()
cheat.register("onPaint", function()
    LogoESP:OnPaint()
end)
\*\*\* ### File Operations #### read Reads the entire content of a specified file and returns it as a string. This function can read both plain text and binary files (like images). \* \*\*Aliases:\*\* file.Read, file.read \* \*\*Signature:\*\* file.read(filepath) \* \*\*Parameters:\*\* \* filepath: string - The path to the file, relative to the sandboxed files/ directory. \* \*\*Returns:\*\* string or nil - The file's content as a string. If the file does not exist or cannot be opened, it returns nil. \* \*\*Usage Examples:\*\* \*\*1. Reading a text file:\*\* \`\`\`lua local welcome\_message = file.read("welcome.txt") if welcome\_message then print(welcome\_message) end \`\`\` \* \*\*2. Loading an image for the draw API:\*\* \`\`\`lua local logo\_data = file.read("images/my\_logo.png") if logo\_data then local texture\_id = utility.loadImage(logo\_data) cheat.register("onPaint", function() draw.image(texture\_id, 10, 10, 128, 128, 255, 255, 255, 255) end) end \`\`\` \*\*\* \*\*write\*\* Writes string content to a specified file. If the file does not exist, it will be created. If the file already exists, its contents will be \*\*completely overwritten\*\*. \* \*\*Aliases:\*\* file.Write, file.write \* \*\*Signature:\*\* file.write(filepath, content) \* \*\*Parameters:\*\* \* filepath: string - The path to the file, relative to the sandboxed files/ directory. \* content: string - The data to be written to the file. This can be binary data or plain text. \* \*\*Returns:\*\* boolean - true if the file was written successfully, false otherwise. \* \*\*Usage Examples:\*\* \*\*1. Saving a simple log:\*\* \`\`\`lua local success = file.write("log.txt", "hello") if not success then print("Failed to write to log file!") end \`\`\` --- # Agent Instructions This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com. ## Querying This Documentation If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with the \`ask\` query parameter, and the optional \`goal\` query parameter: \`\`\` GET https://serotonin-1.gitbook.io/serotonin-docs/api/file.md?ask=&goal= \`\`\` \`ask\` is the immediate question: it should be specific, self-contained, and written in natural language. \`goal\` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation. Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections. ---