Getting started
Alpine runs your scripts in an embedded Lua 5.4 VM. Each script gets its own state and its own thread, so one script cannot stall or break another.
Open the Lua panel, paste this and press Ctrl+Enter.
hook.register("onPaint", function()
local w, h = screen.size()
draw.text_outlined("hello from alpine", w / 2 - 60, 40, color.white)
end)
| Action |
What it does |
| Ctrl+Enter |
Run the script in the current tab. Running again reloads it. |
| Ctrl+S |
Save to the tab's file. If the script is running it reloads. |
| Shift+wheel |
Pan sideways when a line is wider than the editor. |
execute / reload |
The button changes name while the script is loaded. |
unload |
Stops the script and removes its drawings, tabs and widgets. |
A tab that was opened from or saved to a file is watched. When the file changes on disk the tab refreshes, and a running script reloads. Unsaved edits in the panel are never overwritten.
When a script fails, the line is marked in red, the message is shown next to the code and in the status bar, and the tab's dot turns red.
Alpine understands three styles. You can mix them in one script.
| Style |
Example |
Page |
| Native |
draw.rect_filled(x, y, w, h, color.red) |
Drawing, Menu UI, Input |
| Serotonin |
draw.RectFilled(x, y, w, h, Color3.new(1, 0, 0)) |
Serotonin scripts |
| Matcha |
Drawing.new("Square"), UI.AddTab(...) |
Matcha scripts |
Luau syntax such as +=, continue and type annotations is accepted. See Luau support.
file, config, readfile and writefile all work inside one folder next to the program, called files. Paths are relative to it. .. and drive letters are rejected.
Scripts and lifecycle
- The script body runs once, as a task. It may call
task.wait, so a top-level while true do ... task.wait() end loop is fine.
- After the body finishes or pauses for the first time, the script counts as loaded and
onLoad fires.
onFrame fires at the script's tick rate. onPaint fires once per rendered frame.
- On unload,
onUnload fires and everything the script created is removed.
time.set_rate(60)
hook.register("onFrame", function(dt)
end)
hook.register("onPaint", function(dt)
end)
hook.register("onUnload", function()
end)
Draw calls only have an effect inside onPaint.
| Function |
Description |
hook.register(name, fn) |
Add a callback. |
hook.unregister(name, fn) |
Remove it. |
hook.count(name) |
Number of callbacks on an event. |
| Event |
Arguments |
Fires |
onFrame |
dt |
At the tick rate (default 144 per second). |
onPaint |
dt |
Every rendered frame. |
onLoad |
|
Once, after the body ran. |
onUnload |
|
Before the script is removed. |
onMenuOpen, onMenuClose |
|
When the menu opens or closes. |
cheat.register accepts the same events plus the Serotonin names onUpdate, onSlowUpdate, shutdown and newPlace.
A callback that raises an error is reported once and then removed. The rest of the script keeps running.
| Function |
Description |
task.spawn(fn, ...) |
Run fn now as a new task. Returns the thread. |
task.defer(fn, ...) |
Run it on the next tick. |
task.delay(seconds, fn, ...) |
Run it later. |
task.wait(seconds) |
Pause the current task. Returns the time waited. |
task.cancel(thread) |
Stop a task. |
task.count() |
Tasks currently waiting. |
wait, spawn and delay are the same functions without the prefix.
task.wait cannot be called directly inside a hook callback. Wrap the work in task.spawn.
task.spawn(function()
while true do
task.wait(1)
print("one second passed")
end
end)
| Function |
Returns |
time.now() |
Seconds since the script started. |
time.clock() |
Steady clock in seconds. Use it to measure elapsed time. |
time.unix() |
Wall-clock time in seconds since 1970. |
time.dt() |
Seconds since the last paint. |
time.frame() |
Frame counter. |
time.rate(), time.set_rate(hz) |
Tick rate, 0 to 1000. 0 ticks once per rendered frame. |
time.paint_ms() |
How long the last onPaint took. |
screen.size(), screen.width(), screen.height() |
Game window size in pixels. |
| Function |
Description |
script.name(), script.id() |
Identity of the running script. |
script.unload() |
Stop this script from inside. |
print(...), log.info(...) |
Normal console line. |
log.good(...) |
Green line. |
warn(...), log.warn(...) |
Yellow line. |
A single callback or task step may run about 50 million VM instructions. After that it is stopped with an error, so an accidental infinite loop cannot freeze the script thread. A script that produces ten errors within one second is unloaded.
Drawing
Call these inside onPaint. Coordinates are pixels from the top-left of the game window.
Native functions take a packed colour made with color.rgba. The PascalCase versions (draw.Line, draw.RectFilled, ...) take a Color3 instead, see Serotonin scripts.
| Function |
Description |
color.rgba(r, g, b, a) |
Pack 0-255 channels. a defaults to 255. |
color.alpha(col, a) |
Same colour with a new alpha. |
color.unpack(col) |
Returns r, g, b, a. |
color.white, color.black, color.red, color.green, color.blue |
Ready-made colours. |
Most draw calls end with an optional alpha (0-255) that overrides the colour's own alpha.
| Function |
Notes |
draw.line(x1, y1, x2, y2, col, thickness, alpha) |
|
draw.rect(x, y, w, h, col, thickness, rounding, alpha) |
Outline. |
draw.rect_filled(x, y, w, h, col, rounding, alpha) |
|
draw.gradient(x, y, w, h, startCol, endCol, horizontal) |
Vertical unless horizontal is true. |
draw.rect_multi(x, y, w, h, c1, c2, c3, c4) |
One colour per corner. |
draw.circle(x, y, radius, col, thickness, segments, alpha) |
|
draw.circle_filled(x, y, radius, col, segments, alpha) |
|
draw.arc(x, y, radius, a0, a1, col, thickness, segments) |
Angles in radians. |
draw.bezier(x1, y1, x2, y2, x3, y3, x4, y4, col, thickness, segments) |
Cubic curve. |
draw.triangle(x1, y1, x2, y2, x3, y3, col, thickness, alpha) |
|
draw.triangle_filled(x1, y1, x2, y2, x3, y3, col, alpha) |
|
draw.polyline(points, col, closed, thickness, alpha) |
points is { {x, y}, {x, y}, ... }. |
draw.lines(points, col, thickness, alpha) |
Every two points form one separate line. |
draw.polyline_fade(points, col, thickness, alphaStart, alphaEnd, thicknessEnd, curve) |
Trail that fades along its length. |
draw.convex_poly_filled(points, col, alpha) |
|
draw.convex_hull(points) |
Returns the outer hull of a point list. |
draw.glow_rect(x, y, w, h, col, size, rounding) |
Soft glow around a box. |
draw.glow_circle(x, y, radius, col, size) |
|
draw.glass_rect(x, y, w, h, col, rounding) |
Translucent panel with a sheen. |
draw.push_clip(x, y, w, h, intersect), draw.pop_clip() |
Restrict drawing to a rectangle. |
| Function |
Notes |
draw.text(text, x, y, col, size, alpha) |
|
draw.text_outlined(text, x, y, col, size, alpha) |
|
draw.text_font(text, x, y, col, font, alpha, size) |
font is a name from draw.fonts(). |
draw.text_font_outlined(text, x, y, col, font, alpha, size) |
|
draw.text_size(text, font, size) |
Returns width, height. |
draw.fonts() |
List of font names. |
draw.load_font(name, data, size) |
Register a TTF from raw file bytes. |
draw.outline_style(style) |
"shadow", "outline" or "outline8". |
| Function |
Notes |
image.load(data) |
Raw PNG/JPG bytes. Returns an id, or nil. |
image.ready(id) |
True once the texture is on the GPU. |
image.size(id) |
Returns width, height. |
image.free(id) |
Release the texture. |
draw.image(id, x, y, w, h, r, g, b, a) |
Tint channels default to 255. |
local data = file.read("logo.png")
local logo = data and image.load(data)
hook.register("onPaint", function()
if logo and image.ready(logo) then draw.image(logo, 20, 20, 64, 64) end
end)
utility.WorldToScreen(position) returns x, y, onScreen. The Matcha form WorldToScreen(position) returns a Vector2 and a boolean.
Menu UI
Scripts can add their own tabs to the main menu or open separate panels. Widgets keep their values when the script is reloaded.
local tab = ui.tab("My script")
local box = tab:group("Options", 1)
local enabled = box:toggle("Enabled", true)
local range = box:slider_int("Range", 300, 0, 1000, " st")
local mode = box:combo("Mode", { "Box", "Corner", "None" }, 1)
local key = box:keybind("Hold key", 0x46)
enabled:on_change(function(value) print("enabled is now", value) end)
hook.register("onFrame", function()
if enabled:get() and key:active() then
end
end)
| Function |
Description |
ui.tab(name) |
New tab in the main menu. ui.main_tab is the same. |
ui.panel(title, width, height) |
Separate floating panel. |
panel:tab(name), panel:show(bool), panel:toggle(), panel:shown() |
|
tab:group(name, column, height) |
A titled box. column starts at 1. |
tab:columns(n) |
Force the number of columns. |
group:visible(bool) |
Show or hide the whole box. |
| Function |
Value from :get() |
group:toggle(name, default) |
boolean |
group:slider(name, default, min, max, suffix) |
number |
group:slider_int(name, default, min, max, suffix) |
integer |
group:combo(name, items, default) |
index, starting at 1 |
group:multi(name, items, mask) |
bitmask, bit 0 is the first item |
group:color(name, r, g, b, a) |
packed colour; use :rgba() for channels |
group:keybind(name, key) |
Windows virtual-key code of the bound key |
group:input(name, default, hint) |
string |
group:button(name, fn) |
|
group:label(text), group:text(text) |
|
group:spacing(height) |
|
| Method |
Description |
w:get(), w:set(value) |
Read or change the value. |
w:on_change(fn) |
Called with the new value. |
w:on_click(fn) |
Buttons. |
w:rgba() |
Colour widgets: r, g, b, a as 0-255. |
w:active() |
Keybinds: true while the bind is on. Toggles: the value. |
w:mode(), w:set_mode(m) |
Keybinds: 0 hold, 1 toggle, 2 always. |
w:set_active(bool) |
Keybinds: tell the keybind list whether the bind is on. |
w:name(text) |
Rename. |
w:items(list), w:items_list() |
Replace or read combo items. |
w:visible(bool) |
Show or hide. |
key:get() always returns a Windows virtual-key code, such as 0x47 for G, whichever key the user picks in the menu. Pass it straight to input.key_down.
local tab = ui.tab("Keys")
local box = tab:group("Bind")
local key = box:keybind("Boost", 0x47)
hook.register("onFrame", function()
if key:active() then
print("boost is on")
end
end)
Every keybind a loaded script creates is shown in the keybind list panel, next to the built-in ones. The list follows the mode set on the keybind: on while held, flipped on each press for toggle, always on for always.
If a script decides on and off by itself, without key:active(), call key:set_active(state) each frame so the list shows the real state.
local tab = ui.tab("Spin")
local box = tab:group("Spin")
local key = box:keybind("Spin key", 0x47)
local on, wasDown = false, false
hook.register("onFrame", function()
local down = input.key_down(key:get())
if down and not wasDown then on = not on end
wasDown = down
key:set_active(on)
end)
| Function |
Description |
ui.menu_open() |
True while the menu is open. |
ui.notify(text, seconds) |
Toast notification. |
ui.remember(false) |
Call before creating widgets to stop values carrying over a reload. |
A restored value fires on_change once after the script loads. If you change a widget's default, range or item list in the source, the new default wins.
Input
Keys are Windows virtual-key codes (0x46 is F) or names such as "f", "space", "lshift", "f5", "leftmouse". Names are not case sensitive.
| Function |
Description |
input.key_down(vk) |
True while the key or mouse button is held. |
keyboard.IsPressed(key) |
Same, and accepts names. |
keyboard.IsClicked(key) |
True once per press. |
mouse.IsPressed(button), mouse.IsClicked(button) |
Buttons: "leftmouse", "rightmouse", "middlemouse", "mouse4", "mouse5". |
input.mouse() |
Cursor position x, y. |
input.wheel() |
Wheel movement since the last tick. |
input.foreground() |
Title and program name of the focused window. |
input.game_focused() |
True while the game window has focus. |
Check input.game_focused() before sending keys, or a script will type into whatever window is in front.
| Function |
Description |
input.send_key(vk, down) |
Press or release a key. |
input.click_key(vk, holdMs) |
Press and release. Hold defaults to 50 ms. |
input.send_mouse(button, down) |
1 left, 2 right, 4 middle, 5 and 6 side buttons. |
input.click_mouse(button, holdMs) |
Click. Without holdMs the release is immediate. |
input.scroll(delta) |
Positive scrolls up. |
input.move_mouse(dx, dy) |
Move relative to the current position. |
input.set_mouse(x, y) |
Move to a position inside the game window. |
keyboard.Press(key), keyboard.Release(key), keyboard.Click(key, holdMs) |
Name-based versions. |
mouse.Click(button, holdMs), mouse.Press(button), mouse.Release(button), mouse.Scroll(delta), mouse.Move(dx, dy) |
|
| Function |
Description |
input.clipboard_get(), input.clipboard_set(text) |
|
input.random_int(lo, hi), input.random_float(lo, hi) |
|
input.fingerprint() |
Stable id for this machine. |
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then print("E pressed") end
end)
Enum.KeyCode values are Windows key codes, so they can be passed to any function on this page.
Files, web and data
| Function |
Returns |
file.read(path) |
Contents, or nil. Binary safe. |
file.write(path, content) |
true on success. Creates folders as needed. |
file.append(path, content) |
|
file.exists(path), file.isfile(path), file.isdir(path) |
boolean |
file.mkdir(path) |
|
file.delete(path) |
Deletes a file or a whole folder. |
file.list(path) |
Names inside a folder. |
file.root() |
Full path of the files folder. |
Saves a table as configs/<name>.json.
local settings = config.load("my_script", { enabled = true, range = 300 })
settings.range = 500
config.save("my_script", settings)
| Function |
Description |
config.save(name, table) |
|
config.load(name, defaults) |
Missing keys are filled from defaults. |
config.exists(name), config.delete(name), config.list() |
|
| Function |
Description |
json.encode(value, pretty) |
pretty adds indentation. |
json.decode(text) |
Returns the value, or nil, message. null becomes nil. |
base64.encode(data), base64.decode(text) |
Binary safe. |
| Function |
Description |
http.get(url, headers, callback) |
Runs in the background. |
http.post(url, headers, body, callback) |
|
http.request(method, url, headers, body, callback) |
Any method. |
http.get_sync(url, headers) |
Blocks. Returns body, status, error. |
http.post_sync(url, headers, body) |
|
The callback receives body, status, error. body is nil when the request failed.
http.get("https://httpbin.org/json", nil, function(body, status)
if not body then return end
local data = json.decode(body)
print(status, data and data.slideshow and data.slideshow.title)
end)
require("name") loads name.lua from the files folder once and returns its result. loadstring(source) compiles text.
| Function |
Description |
audio.playSound(wav, loop, volume, pitch) |
wav is the raw bytes of a .wav file. Volume 0-2, pitch is a speed multiplier. |
audio.beep(frequency, ms) |
|
audio.stopAll() |
|
One sound plays at a time. A script's sound stops when it unloads.
Game, entities and memory
Every name on this page also exists in camelCase and snake_case, for example entity.GetPlayers, entity.getPlayers and entity.get_players.
Parameter names below are taken from the implementation.
game.Workspace, game.Players, game.LocalPlayer, game.DataModel, game.PlaceID and game.CameraPosition are properties. workspace is a global shortcut.
game.ClearCache()game.DefineProperty(className, name, type_, offset, via)game.FindFirstChild(self, name)game.GetCameraPos()game.GetChildren()game.GetOffset(name)game.GetPing()game.GetService(self, name)game.HttpGet(_, url, ...)game.IsA(self, c)game.Refresh()game.SetCacheTTL(seconds)game.SetOffset(name, value)game.Wrap(addr)game.getservice(self, name)
Services returned by game:GetService are instances from the game, except RunService, UserInputService and HttpService, which Alpine provides itself.
Read properties with a dot: part.Position, part.Size, humanoid.Health, inst.Name, inst.ClassName, inst.Parent, inst.Address. Which properties exist depends on the offsets the program has loaded.
instance:FindFirstAncestor(name)instance:FindFirstAncestorOfClass(className)instance:FindFirstChild(name, recursive)instance:FindFirstChildOfClass(className)instance:FindFirstChildWhichIsA(className, recursive)instance:FindFirstDescendant(name)instance:FindFirstDescendantOfClass(className)instance:FindFirstDescendantWhichIsA(className)instance:GetBoneCFrame(name)instance:GetBoneInstance(name)instance:GetBonePosition(name)instance:GetBoundingBox()instance:GetCharacter()instance:GetChildren()instance:GetDescendants()instance:GetDisplayName()instance:GetFullName()instance:GetHead()instance:GetHealth()instance:GetHumanoid()instance:GetMaxHealth()instance:GetPosition()instance:GetRootPart()instance:GetTeam()instance:IsA(className)instance:IsAlive()instance:IsAncestorOf(other)instance:IsDescendantOf(other)instance:ReadProperty(type_, offset)instance:WaitForChild(name)instance:WriteProperty(type_, offset, value)
A cached list of players that is cheap to read every frame.
entity.AddEntity(target, name, enemy, team)entity.AddModel(key, data)entity.ClearModels()entity.Count()entity.Debug()entity.EachBone(bone, fn, opts)entity.EditModel(key, changes)entity.FromInstance(inst)entity.GetBonePositions(bone, opts)entity.GetBots()entity.GetCameraCFrame()entity.GetCameraFOV()entity.GetCameraLookVector()entity.GetCameraPosition()entity.GetCameraYaw()entity.GetESP(opts, buffer, weapons)entity.GetEntities()entity.GetLocalPlayer()entity.GetNPCs()entity.GetPartInstance(index)entity.GetPartPosition(index)entity.GetPartRotation(index)entity.GetPartSize(index)entity.GetParts()entity.GetPlayerByAddress(addr)entity.GetPlayerByName(name)entity.GetPlayers(onlyEnemies, includeBots)entity.GetTarget()entity.HumanoidStateName(id)entity.IsBot(p)entity.IsPlayer(v)entity.MarkBot(target, isBot)entity.RemoveEntity(target)entity.RemoveModel(key)entity.SetBotRules(rules)entity.SetNPCScan(cfg)entity.SetPartScan(maxParts, seconds)entity.WorldToScreen(v)
player:Alive()player:Enemy()player:GetAccountAge()player:GetAddress()player:GetBone(name)player:GetBoneAddress(name)player:GetBoneCFrame(name)player:GetBoneInstance(name)player:GetBoneNames()player:GetBonePosition(name)player:GetBoneRotation(name)player:GetBoneScreen(name)player:GetBoneSize(name)player:GetBones()player:GetBot()player:GetBoundingBox()player:GetCFrame()player:GetCharacter()player:GetDisplayName()player:GetDistance()player:GetHead()player:GetHeadCFrame()player:GetHeadLookVector()player:GetHealth()player:GetHumanoid()player:GetHumanoidState()player:GetHumanoidStateId()player:GetLookVector()player:GetMaxHealth()player:GetName()player:GetNetworkPing()player:GetPosition()player:GetRigType()player:GetRightVector()player:GetRootPart()player:GetRotation()player:GetTeam()player:GetTeamColor()player:GetUserId()player:GetVelocity()player:GetWeapon()player:GetWhitelisted()player:GetYaw()player:Local()player:MarkBot(v)player:NPC()player:Visible()
utility.GetCameraCFrame()utility.GetCameraFOV()utility.GetCameraLookVector()utility.GetCameraPosition()utility.GetMousePos()utility.GetPing()utility.GetTickCount()utility.LoadImage(data)utility.MoveMouse(dx, dy)utility.Notify(text, kind, duration)utility.RandomFloat(lo, hi)utility.RandomInt(lo, hi)utility.SetClipboard(text)utility.WorldToScreen(v, vy, vz)
cheat.Notify(text, kind, duration)cheat.Register(name, fn)cheat.Unregister(name, fn)
utility.GetPing() returns your ping to the server in milliseconds, or nil while there is no game to read it from. game.GetPing() is the same function. player:GetNetworkPing() returns it in seconds, like the Roblox call.
hook.register("onPaint", function()
local ping = utility.GetPing()
if ping then
draw.text_outlined(string.format("%d ms", ping), 20, 20, color.white)
end
end)
Type names: float, double, int, uint, bool, byte, short, ushort, int64, uint64, pointer, string, vector2, vector3, color3, cframe.
memory.IsValid(address)memory.Read(type_, address)memory.ReadBytes(address, count)memory.ReadCFrame(address)memory.ReadChain(address, offsets)memory.ReadFloat(address)memory.ReadInt(address)memory.ReadPointer(address)memory.ReadString(address, maxLength)memory.ReadVector3(address)memory.Rebase(offset)memory.Write(type_, address, value)memory.WriteBytes(address, bytes)memory.WriteFloat(address, v)memory.WriteInt(address, v)memory.WritePointer(address, v)memory.WriteString(address, value)memory.WriteVector3(address, v)
Datatypes
typeof(value) returns the names used on this page.
Vector3.new(x, y, z). Fields X, Y, Z, Magnitude, Unit. Supports + - * /, unary minus and ==.
Constants: Vector3.zero, Vector3.one, Vector3.xAxis, Vector3.yAxis, Vector3.zAxis.
v:Abs()v:Angle(o, axis)v:Ceil()v:Clone()v:Cross(o)v:Distance(o)v:Dot(o)v:Floor()v:FuzzyEq(o, eps)v:Length()v:Lerp(o, t)v:Max(o)v:Min(o)v:Normalize()v:Project(o)v:Reflect(n)v:Sign()v:Slerp(o, t)v:ToYawPitch()Vector3.new(x, y, z)
Vector2.new(x, y). Fields X, Y, Magnitude, Unit.
v:Abs()v:Angle()v:Ceil()v:Clone()v:Cross(o)v:Dot(o)v:Floor()v:FuzzyEq(o, eps)v:Lerp(o, t)v:Max(o)v:Min(o)Vector2.new(x, y)
CFrame.new(), CFrame.new(x, y, z), CFrame.Angles(rx, ry, rz), CFrame.fromOrientation(rx, ry, rz). Fields Position, X, Y, Z, LookVector, RightVector, UpVector. cf * cf combines, cf * vector transforms a point.
CFrame.Angles(rx, ry, rz)cf:GetComponents()cf:Inverse()cf:Lerp(o, t)CFrame.LookAt(from, target, up)cf:PointToObjectSpace(v)cf:PointToWorldSpace(v)cf:ToEulerAnglesXYZ()cf:ToMatrix12()cf:ToObjectSpace(cf)cf:ToOrientation()cf:ToWorldSpace(cf)cf:VectorToObjectSpace(v)cf:VectorToWorldSpace(v)cf:components()CFrame.fromAxisAngle(axis, angle)CFrame.fromMatrix(m, p)CFrame.fromOrientation(rx, ry, rz)CFrame.new(x, y, z, r00, r01, r02, r10, r11, r12, r20, r21, r22)
Color3.new(r, g, b) with 0-1 channels, Color3.fromRGB(r, g, b), Color3.fromHSV(h, s, v), Color3.fromHex("#ff8800"). Fields R, G, B.
c:Clone()c:Lerp(o, t)c:ToHSV()c:ToHex()c:ToRGB()Color3.fromHSV(h, s, v)Color3.fromHex(hex)Color3.fromRGB(r, g, b)Color3.new(r, g, b)
| Constructor |
Fields |
UDim.new(scale, offset) |
Scale, Offset |
UDim2.new(xScale, xOffset, yScale, yOffset), UDim2.fromOffset(x, y), UDim2.fromScale(x, y) |
X, Y, Width, Height |
Ray.new(origin, direction) |
Origin, Direction, Unit, :ClosestPoint(p), :Distance(p) |
local rng = Random.new(42)
print(rng:NextInteger(1, 6), rng:NextNumber(), rng:NextNumber(0, 10))
Also rng:NextUnitVector(), rng:Shuffle(list) and rng:Clone().
Enum.KeyCode.E, Enum.KeyCode.LeftShift, Enum.KeyCode.MouseButton1, Enum.UserInputType.Keyboard, Enum.Material.Neon. Each item has Name and Value.
Luau support
The VM is Lua 5.4. Scripts written for Roblox's Luau are translated when they load. Line numbers stay the same, so errors point at the right line.
| Luau |
Example |
| Compound assignment |
count += 1, text ..= "!" |
continue |
if not ok then continue end |
| Type annotations and casts |
local n: number = 5, x :: any |
type and export type |
type Point = { x: number, y: number } |
if as a value |
local c = if hp > 50 then green else red |
| String interpolation |
`{name} has {hp} hp` |
| Looping over a table directly |
for key, value in tbl do |
| Number literals |
1_000_000, 0b1010 |
| Group |
Functions |
| Tasks |
task.spawn, task.wait, task.delay, task.defer, task.cancel, wait, spawn, delay, tick |
| Bits |
bit32.band, bor, bxor, bnot, lshift, rshift, arshift, lrotate, rrotate, extract, replace, countlz, countrz, byteswap |
| Maths |
math.clamp, math.round, math.sign, math.lerp, math.map, math.noise, math.atan2, math.pow |
| Strings |
string.split, string.trim, string.startswith, string.endswith |
| Tables |
table.find, table.clone, table.clear, table.create, table.keys, table.count, table.freeze |
| Globals |
typeof, getgenv, getfenv, setfenv, newproxy, gcinfo, unpack, loadstring, shared |
tostring(5.0) and print(5.0) give 5.
string.format("%d", 3.7) gives 3 instead of an error.
math.random, string.sub and string.rep accept fractional numbers.
- Joining a fractional-type number with
.. still shows .0, for example "HP: " .. 100.0 gives HP: 100.0. Use tostring, string.format or a backtick string.
continue inside repeat ... until fails if a local is declared between the continue and the until.
- An
if used as a value cannot use ... from the surrounding function.
error raises a real error, as in standard Lua.
Matcha scripts
Scripts written for Matcha load without changes when they stay within the functions below. Luau syntax is translated, see Luau support.
| Area |
Names |
| Drawing |
Drawing.new with Square, Line, Circle, Text, Triangle, Quad, Image; :Remove(); Drawing.Fonts; cleardrawcache, isrenderobj, getrenderproperty, setrenderproperty |
| UI |
UI.AddTab, UI.RemoveTab, UI.GetValue, UI.SetValue, tab:Section, Toggle, Keybind, SliderInt, SliderFloat, Combo, Button, ColorPicker, ColorPicker2, InputText, Text, Spacing |
| Services |
RunService.Heartbeat, RenderStepped, Stepped; UserInputService.InputBegan, InputEnded; HttpService:JSONEncode, JSONDecode, GenerateGUID |
| Input |
keypress, keyrelease, iskeypressed, mouse1press, mouse1release, mouse1click, mouse2press, mouse2release, mouse2click, ismouse1pressed, ismouse2pressed, mousemoveabs, mousemoverel, mousescroll, setclipboard, isrbxactive |
| Files |
writefile, readfile, appendfile, makefolder, isfile, isfolder, listfiles, delfile, delfolder |
| Web |
httpget, httppost, request, game:HttpGet |
| Memory |
getbase, memory_read, memory_write |
| Globals |
WorldToScreen, notify, identifyexecutor, gethwid, base64encode, base64decode, tick, typeof, getgenv, getfenv, setfenv, loadstring, require, wait, spawn, task.*, printl, warn |
| Datatypes |
Vector3, Vector2, CFrame, Color3, UDim, UDim2, Ray |
local box = Drawing.new("Square")
box.Position = Vector2.new(100, 100)
box.Size = Vector2.new(60, 120)
box.Color = Color3.fromRGB(255, 80, 80)
box.Thickness = 1
box.Visible = true
| Type |
Properties |
| all |
Visible, Color, Transparency (1 is solid), ZIndex, Position |
Square |
Size, Filled, Thickness, Rounding |
Line |
From, To, Thickness |
Circle |
Radius, NumSides, Thickness, Filled |
Text |
Text, Size, Center, Outline |
Triangle |
PointA, PointB, PointC, Filled, Thickness |
Quad |
PointA to PointD, Filled, Thickness |
Image |
Data (raw file bytes), Size, Rounding |
| Matcha |
Alpine |
error(...) prints and continues |
Raises a real error. |
task.defer, task.delay do nothing |
Both work. |
| Section pages are tabs |
Shown as a "page" dropdown at the top of the section. |
Font on text drawings |
Accepted and ignored; the default font is used. |
Enum.KeyCode values |
Windows key codes. |
sec:Tip |
Does nothing. |
These need access to the game's own scripts or engine, which Alpine does not have: decompile, getscripts, getscriptbytecode, getscripthash, getgc, setgc, applygc, firetouchinterest, fireclickdetector, fireproximityprompt, RemoteEvent:FireServer, RemoteFunction:InvokeServer, queue_on_teleport, setfflag, getfflag, run_secure, Instance.new.
They are left undefined, so a check such as if getgc then behaves correctly.
Also not available: GetAttribute, SetAttribute, Workspace:Raycast, GetPingValue, getrbxversion, getgamename.
Serotonin scripts
Alpine's PascalCase API follows Serotonin's, so most Serotonin scripts run unchanged. Every function also exists in camelCase and snake_case.
| Area |
Names |
| cheat |
cheat.register with onUpdate, onSlowUpdate, onPaint, shutdown, newPlace; cheat.getWindowSize |
| draw |
Line, Rect, RectFilled, Circle, CircleFilled, Triangle, TriangleFilled, Gradient, Polyline, ConvexPolyFilled, Text, TextOutlined, GetTextSize, Image, ComputeConvexHull, GetPartCorners |
| utility |
RandomInt, RandomFloat, GetTickCount, GetFingerprint, SetClipboard, GetClipboard, MoveMouse, GetDeltaTime, GetMousePos, GetMenuState, WorldToScreen, LoadImage |
| input |
mouse.Click, mouse.IsClicked, mouse.Scroll, keyboard.Press, keyboard.Release, keyboard.Click, keyboard.IsPressed |
| ui |
newTab, newContainer, newCheckbox, newSliderInt, newSliderFloat, newDropdown, newMultiselect, newColorpicker, newInputText, newButton, newListbox, getValue, setValue, setVisibility |
| entity |
GetPlayers, GetLocalPlayer, player fields and bone functions, GetParts, getPartPosition, getPartSize, getPartRotation, AddModel, EditModel, RemoveModel, ClearModels |
| game |
Workspace, Players, LocalPlayer, DataModel, PlaceID, CameraPosition, GetService, instance methods |
| other |
file.read, file.write, http.Get, http.Post, memory.Read, memory.Write, memory.GetBase, memory.Rebase, audio.playSound, audio.beep, audio.stopAll, Vector3, Color3 |
local tab, box = "demo_tab", "demo_box"
ui.newTab(tab, "Demo")
ui.newContainer(tab, box, "Options")
ui.newCheckbox(tab, box, "Enabled")
ui.setValue(tab, box, "Enabled", true)
cheat.register("onPaint", function()
if not ui.getValue(tab, box, "Enabled") then return end
local w, h = cheat.getWindowSize()
draw.RectFilled(w / 2 - 60, 20, 120, 24, Color3.fromRGB(20, 20, 20), 4, 200)
draw.TextOutlined("serotonin style", w / 2 - 48, 25, Color3.new(1, 1, 1))
end)
| Serotonin |
Alpine |
| Dropdown value starts at 1 |
ui.getValue returns an index starting at 0. |
entity.GetParts reads a host cache |
Scans the workspace every 2 seconds, up to 4,096 parts. Change with entity.SetPartScan(maxParts, seconds). |
entity.AddModel uses Team, Weapon, Health |
Only Character and Name are used. |
| Several sounds can overlap |
One sound at a time. |
game.SilentAim, game.PlayerWhitelist, game.GetFFlag, game.SetFFlag, :GetAttribute, :GetAttributes, :GetFirstAttributeOfType, :SetHighlightOnTop, :SetHighlightTransparency.
Examples
local tab = ui.tab("Watermark")
local box = tab:group("Options", 1)
local enabled = box:toggle("Show watermark", true)
local tint = box:color("Colour", 120, 200, 255, 255)
hook.register("onPaint", function()
if not enabled:get() then return end
local w = screen.width()
local r, g, b = tint:rgba()
local text = "alpine | " .. math.floor(time.now()) .. "s"
local tw = draw.text_size(text)
draw.rect_filled(w - tw - 28, 12, tw + 16, 22, color.rgba(15, 18, 24, 220), 4)
draw.text(text, w - tw - 20, 16, color.rgba(r, g, b))
end)
local settings = config.load("clicker", { delay = 0.5, key = 0x46 })
local tab = ui.tab("Clicker")
local box = tab:group("Options", 1)
local delay = box:slider("Delay", settings.delay, 0.05, 2, " s")
local key = box:keybind("Hold to click", settings.key)
delay:on_change(function(v) settings.delay = v config.save("clicker", settings) end)
key:on_change(function(v) settings.key = v config.save("clicker", settings) end)
while true do
if key:active() and input.game_focused() then mouse.Click("leftmouse", 20) end
task.wait(delay:get())
end
local RunService = game:GetService("RunService")
local label = Drawing.new("Text")
label.Position = Vector2.new(20, 200)
label.Outline = true
label.Visible = true
local frames = 0
RunService.RenderStepped:Connect(function(dt: number)
frames += 1
if frames % 2 == 0 then return end
label.Text = `frame {frames}, {math.floor(1 / math.max(dt, 0.001))} fps`
label.Color = if frames % 120 < 60 then Color3.new(1, 1, 1) else Color3.fromRGB(120, 200, 255)
end)
http.get("https://httpbin.org/uuid", nil, function(body, status, err)
if not body then
warn("request failed:", err)
return
end
local data = json.decode(body)
ui.notify("uuid: " .. tostring(data and data.uuid), 4)
end)
Connecting an AI
Alpine can host an MCP server, so an AI assistant on your PC can run scripts in the VM, read the console and look up this reference by itself.
| Tool |
What it does |
lua_eval |
Runs Lua once. return sends values back. Each call replaces the one before. |
lua_run |
Loads a script that keeps running, like pressing run in the editor. |
console_read |
Reads the console. Takes a cursor, and can wait for new lines. |
console_write |
Writes a line to the console. |
scripts_list |
Lists scripts with their state and last error. |
script_stop |
Stops one script, or all of them. |
api_docs |
Reads these pages: the list of sections, one section, or a search. |
api_reference |
Lists the names the VM exposes, read live. |
vm_status |
Says whether the VM is running, with script count and rate. |
Use lua_run for anything with hooks or keybinds. A script loaded with lua_eval is unloaded by the next lua_eval.
When the server is on, the console shows the address:
mcp: listening on http://127.0.0.1:38417/mcp
Open http://127.0.0.1:38417/health in a browser to check it answers.
| Client |
How |
| Takes a URL |
http://127.0.0.1:38417/mcp |
| Takes a URL, older event-stream style |
http://127.0.0.1:38417/sse |
| Launches a program |
alpine_mcp_bridge.exe as the command |
For a client that launches a program, such as the Claude desktop app, add this to its MCP config file and restart it:
{
"mcpServers": {
"alpine": {
"command": "C:\\path\\to\\alpine_mcp_bridge.exe"
}
}
}
Then ask the assistant to use the alpine tools, for example: "call vm_status, then run lua_eval with return 1 + 1".
If the server was started with a token, send it as a bearer token, put it on the end of the address (/mcp/your-token), or pass --token your-token to the bridge.
The server only answers on your own PC. Anything that can reach it can run code in your game session, so keep it off when you are not using it.