api.client: see the AR2 client section for getItems, equipItem, useItem, and the rest.)
Methods
Signals
Call:Connect(callback) on these. They get cleaned up when your script unloads.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
AR2 api.game: world pings, your squad, and zombies.
api.client: see the AR2 client section for getItems, equipItem, useItem, and the rest.)
| Call | What it does |
|---|---|
ping(position) | Drop a world ping at a Vector3. |
pingPlayer(player) | Drop a world ping on a player’s current position. |
clearPing() | Clear your world ping. |
getSquad() | Returns the Players in your squad. Empty when you’re solo. |
isSquadmate(player) | Returns whether a player is in your squad. |
getZombies() | Returns the zombie Models currently in the world. |
:Connect(callback) on these. They get cleaned up when your script unloads.
| Signal | Your callback receives |
|---|---|
onSquadChanged | (): someone joined or left your squad. Read getSquad() for the new roster. |
onZombieAdded | (zombie: Model): a zombie spawned. |
onZombieRemoved | (zombie: Model): a zombie despawned or died. |
-- Ping the nearest enemy
local target = api.legitbot.getTarget()
if target then
api.game.pingPlayer(target.player)
end
-- Squad roster pill
api.game.onSquadChanged:Connect(function()
api.ui.toast(`Squad: {#api.game.getSquad()} members`)
end)