Utilities

Gameplay helpers

Targeting, Players, Rot, Move, Inv, Combat and Clicker.

Targeting

Finds and measures entities.

Targeting.nearby(opts)

Returns entities sorted by distance, nearest first. opts is the same as for mc.getEntities, plus:

OptionMeaning
fovOnly entities within this many degrees in front of you (total width)

Targeting.nearest(opts)

The first entity from Targeting.nearby, or nil.

Targeting.angleTo(entity, aimHeight = 0.85)

Returns the yaw, pitch needed to look at the entity. aimHeight is a fraction of its height: 0 is the feet, 1 the top.

Targeting.byId(id)

Finds an entity by ID within 128 blocks.

Targeting.byName(name)

Finds a player by name within 256 blocks. Case-insensitive.

Targeting.track(list)

Call every frame with a list of entities. It records their positions so that velocity can be estimated.

Targeting.velocity(id)

Returns the estimated vx, vy, vz of a tracked entity (zeros if unknown).

Targeting.predict(entity, seconds)

Returns the position x, y, z the entity will have after seconds, using that velocity.

Players

Players.LocalPlayer()

Returns mc.getPlayer(). It is a function: write Players.LocalPlayer().

Players.GetPlayers(range = 64)

Returns the players within range.

Players.GetPlayerByName(name)

Finds a player by name.

Players:FindFirstChild(name)

Same as GetPlayerByName, written as a method call.

Players.PlayerAdded, Players.PlayerRemoved

Signals that fire with the entity when a player comes within 128 blocks or leaves. They check four times a second, and only while something is connected.

Players.PlayerAdded:Connect(function(p)
  print(p.name, "appeared")
end)

Rot

Smooth rotation.

Rot.smoothTo(yaw, pitch, speed = 20)

Turns toward the angles by at most speed degrees per call. Call it every frame. Returns true once it is within 1 degree.

Rot.smoothLookAt(entity, speed, aimHeight)

Same, aimed at an entity.

Move

Move.forward(yaw, speed)

Returns the dx, dz velocity for moving at speed in the direction of yaw.

Move.setSpeed(speed)

Sets your horizontal velocity to speed in the direction you are facing and keeps your vertical velocity.

Move.hop(power = 0.42)

Jumps by setting the vertical velocity, only while on the ground.

Inv

Works on the hotbar (slots 0 to 8) and, for count, the first 36 slots.

Inv.find(text)

Returns slot, item for the first hotbar item whose name contains text (case-insensitive), or nil.

Inv.select(text)

Selects that item's slot. Returns true if found.

Inv.count(text)

Total number of matching items in slots 0 to 35.

Inv.heldName()

Name of the held item, or nil.

Combat

Combat.attackNearest(range = 4, cps = 8, opts)

Returns a function. Call that function every frame: it attacks and swings at the nearest target when the cooldown allows (cps attacks per second), and returns the target or nil.

local step = Combat.attackNearest(4, 10)
RunService.Heartbeat:Connect(step)

Clicker

An auto-clicker built on mc.click.

Clicker.new(opts)

OptionDefaultMeaning
button"left"Which mouse button
cps12Clicks per second, 1 to 30
jitter0.25Random variation of the delay, 0 to 0.9
whileHoldingfalseOnly click while you physically hold the button

The new clicker is stopped. Fields: running, clicks (total clicks made).

c:Start(), c:Stop()

Start or stop clicking.

c:Toggle()

Flips it and returns whether it is now running.

c:SetCps(value)

Changes the speed (1 to 30).

c:Destroy()

Stops it and disconnects it.

local clicker = Clicker.new({ cps = 10, whileHolding = true })
clicker:Start()