Welcome to the Polytoria Executor scripting guide. This tutorial will take you from the basics of Lua through to your first in-game automation.
Prerequisites
Before drafting your first script, ensure you have:
1. Injected the Executor into Polytoria.
2. Enabled the UI by pressing DELETE.
3. Basic Lua Knowledge (Understanding variables and basic functions).
Your First Script
The simplest way to verify your executor is working is through the sendchat function.
Exercise: Hello World
Type the following code in the executor tab and click Run:
-- Simple ESP-style box around a partlocalEnv=game["Environment"]game.Rendered:Connect(function(dt)draw_clear()localtarget=Env:FindChild("TargetPart")iftargetthen-- Get screen position (simplified)localpos=target.Positiondraw_rect(pos.x-20,pos.y-20,40,40,255,0,0,255,2,0)endend)
-- Keep trying until tool is foundlocaltoolrepeatwait(0.5)localbackpack=game["Players"].LocalPlayer:FindChild("Backpack")tool=backpack:FindChild("Sword")untiltoolequiptool(tool)
-- Wrap in pcall for safetylocalsuccess,err=pcall(function()localtool=game["Players"].LocalPlayer.Backpack:FindChild("Tool")equiptool(tool)end)ifnotsuccessthenprint("Error: "..tostring(err))end
Best Practices
Check if children exist - Use FindChild to verify objects.
Add delays - Don't spam functions like activatetool too quickly.
Clear drawings - Always draw_clear() before redrawing in a loop.
Check returns - Custom executor functions may return error strings.
Use pcall - Protect against crashes in mission-critical scripts.