evasivedocs
Roblox scriptingLuau 0.748 · 24 guides · 385 API entries
Advanced

What works differently here

evasive runs Luau outside the game and reads Roblox from there. Most Roblox code works as you know it, but some things behave differently. This page lists them so they do not catch you out.

The engine

error() prints, it does not raise

error("message") prints a red line and the script carries on. To raise an error that stops the current thread (or that pcall can catch), use assert:

Luau
local character = game:GetService("Players").LocalPlayer.Character
assert(character, "no character yet")

wait and task.wait return the time waited

Both return the seconds that actually passed, as Roblox's do. while wait() do loops work.

task.spawn, task.defer and task.delay

All three pass extra arguments on to the function and return the new thread. task.defer and task.delay run their function as you would expect. task.cancel(thread) stops a waiting thread.

loadstring

loadstring(source) (also called load) returns a function you can call, and the chunk's return values come back from that call:

Luau
local add = loadstring("return 2 + 3")
print(add()) -- 5

When the source has a syntax error, you still get a function back, plus the message as a second value. Calling that function prints the error instead of running anything:

Luau
local fn, message = loadstring("print(")
if message then
    warn("does not compile:", message)
end

require

require("name.lua") loads a file from your scripts folder, not a ModuleScript from the game. The extension is required (.lua or .luau), paths are relative to the scripts folder and cannot leave it, and each module runs once per script.

Luau
-- scripts\utils.lua
local utils = {}
function utils.round(n)
    return math.floor(n + 0.5)
end
return utils
Luau
-- any other script
local utils = require("utils.lua")
print(utils.round(2.6))

Globals

  • Each script has its own globals. _G and shared are one table shared by every script, and they start empty. They do not hold the built-in functions.
  • getfenv() returns your script's own globals, so getfenv().print is print.
  • There is no script global, because your code is not a script object inside the game.
  • os has clock, date, difftime and time. debug has info and traceback. There is no io.

tick()

tick() counts seconds from when evasive started. Use it to measure time between two points. For the date and time of day, use os.time() and os.date().

The time budget

A thread that runs for 3 seconds without waiting stops its whole script. See How scripts run.

The game

Reads are live

Every property read goes to the game's memory at that moment. Nothing is cached, and nothing goes stale. Reading the same property twice in a row can give two different answers.

Most properties are read-only

You can read far more than you can write. The properties you can set are listed on Permissions. Setting any other one raises "Unable to assign property X. Property is read only".

Events come from polling

evasive cannot hook game events, so it checks for changes instead:

Event How often evasive checks
RunService.Heartbeat, Stepped every tick
RunService.RenderStepped every tick in which the overlay drew a frame
Players.PlayerAdded, PlayerRemoving 10 times a second
Player.CharacterAdded, CharacterRemoving 20 times a second
UserInputService.InputBegan, InputEnded every tick

Two results of that:

  • An event can arrive a few milliseconds late.
  • PlayerRemoving and CharacterRemoving fire after the object is already gone, so its properties read as empty. Store what you need when it arrives.

Polling only runs while a script is connected to the event, so unused events cost nothing.

Stepped passes one argument

RunService.Stepped passes only the time since the last tick, not Roblox's two values. Heartbeat and RenderStepped pass one value, as in Roblox.

Input objects

InputBegan and InputEnded give you an object with KeyCode, Position and UserInputState. There is no UserInputType. Mouse buttons are Enum.KeyCode.MouseButton1 to MouseButton5, and UserInputState is the string "Begin" or "End". gameProcessed is true when Roblox was not the window in front.

Instances

  • == compares the objects, and the same object is the same value, so instances work as table keys.
  • obj.ChildName finds a child by name when no property or method has that name. game.Players and similar find services by class.
  • GetAttributes() returns a table of name to value.
  • Camera.lookAt(from, to) builds a CFrame and returns it. It does not move the camera.
  • CFrame == CFrame compares the values.

Coordinates

WorldToScreen, Camera:WorldToViewportPoint, Drawing positions, GetMouseLocation(), Mouse.X and Mouse.Y and mousemoveabs all use pixels inside the Roblox window, with (0, 0) at its top left corner. They agree with each other, so you can pass one straight into another.

Teleports

Scripts keep running across a teleport. game and workspace follow you to the new place. Objects you stored from the old place read as empty afterwards.

Other functions

Function Here
identifyexecutor() returns "evasive" and a version
base64encode(text) handles every byte, including zero bytes
httpget, httppost, game:HttpGet, game:HttpPost all work, and pause your thread instead of freezing the engine
getgamename(), getscripts() pause your thread while they work
getscripts() finds every script object in the game, but their code cannot be read
cancallserver() always false
setfastflag(name, value) / getfastflag(name) do nothing / return 0
getping() your ping to the server in milliseconds, or 0 on the Roblox home screen