Making your own menu tab
A script can add its own tab to the evasive menu, with toggles, sliders, colour pickers and keybinds that look and work like the built-in ones. This tutorial builds a settings tab and wires it to a script.
The idea
UI.AddTab(name, fn) adds a tab after Config in the menu's tab bar. evasive calls fn(tab) every frame, and inside it you declare the sections and widgets you want. You describe the tab, evasive draws it and keeps the values.
UI.AddTab("My Script", function(tab)
local main = tab:Section("Main", "Left")
main:Toggle("enabled", "Enabled")
main:SliderInt("range", "Range", 50, 2000, 500)
end)Run it, open the menu, and the "My Script" tab is there. Stop the script and the tab goes away.
Because fn runs every frame, keep it to declaring widgets. It cannot wait, and it should not do slow work. Put the actual feature in the rest of the script.
Reading values
Each widget has an id, the first string you pass. Read the value anywhere with UI.GetValue(id):
UI.AddTab("My Script", function(tab)
local main = tab:Section("Main", "Left")
main:Toggle("enabled", "Enabled")
main:SliderInt("range", "Range", 50, 2000, 500)
end)
while true do
if UI.GetValue("enabled") then
print("on, range", UI.GetValue("range"))
end
task.wait(1)
endIds belong to your script, so two scripts can both use "enabled" without stepping on each other.
UI.SetValue(id, value) changes a value from code. It does not run the widget's callback, since callbacks are for changes the user makes.
The values are saved to scripts\<your script>.ui.json a moment after each change and when the script stops. The next time it runs, every widget starts where the user left it.
Sections
tab:Section(name, side) makes a card in the "Left" or "Right" column. Widgets you add to it stack top to bottom.
Pass a list of page names to get a card with its own small tabs. section.page tells you which page is showing, counting from 0:
UI.AddTab("Visuals", function(tab)
local look = tab:Section("Look", "Left", { "Boxes", "Labels" })
if look.page == 0 then
look:Toggle("boxes_on", "Draw boxes")
look:SliderInt("box_width", "Line width", 1, 6, 2)
else
look:SliderFloat("label_scale", "Label scale", 0.5, 3, 1, "%.1f")
end
end)A fourth argument gives the card a maximum height in pixels. Longer content scrolls inside it.
The widgets
| Widget | Call | Value |
|---|---|---|
| Toggle | sec:Toggle(id, label, default, callback) |
true or false |
| Slider (whole numbers) | sec:SliderInt(id, label, min, max, default, callback) |
a number |
| Slider (decimals) | sec:SliderFloat(id, label, min, max, default, format, callback) |
a number |
| Dropdown | sec:Combo(id, label, items, default, callback) |
the index, from 0 |
| Text field | sec:InputText(id, label, default, callback) |
a string |
| Colour | sec:ColorPicker(id, r, g, b, a, callback) |
a Color3 and an alpha |
| Two colours | sec:ColorPair(id1, {r, g, b, a}, id2, {r, g, b, a}, callback) |
two of each |
| Keybind | sec:Keybind(id, key, mode, callback) |
true while active |
| Button | sec:Button(label, callback) or sec:Button(label, width, height, callback) |
none |
| Label | sec:Text(text) |
none |
| Tooltip | sec:Tip(text) |
none |
| Gap | sec:Spacing() |
none |
Everything after the label is optional, and the callback always comes last. Colour values go from 0 to 1. format is a printf pattern such as "%.1f", or "%.0f ms" to add a unit.
A text field's callback runs when the field loses focus (Enter, Esc or a click elsewhere), not on every key.
Widget objects
Every widget call returns an object you can keep:
local mode
UI.AddTab("Targeting", function(tab)
local choice = tab:Section("Choice", "Left")
mode = choice:Combo("mode", "Mode", { "Closest", "Lowest health", "Random" }, 0)
end)
task.wait(1)
print(mode.value, mode:GetText())
mode:SetValue(2)
mode:Add("Highest level").value and :GetValue() read the value, and :SetValue(v) sets it. A dropdown also has :GetText(), :GetItems(), :Add(item), :Remove(item) and :Clear(). A colour picker has .alpha next to .value.
Keybinds
Put a keybind right after a toggle and it sits at the end of that toggle's row:
UI.AddTab("Binds", function(tab)
local sec = tab:Section("Features", "Left")
sec:Toggle("speed_on", "Speed boost")
local kb = sec:Keybind("speed_key", Enum.KeyCode.F, "hold")
kb:ShowInKeybinds("Speed boost", "speed_on")
end)The key can be an Enum.KeyCode item or a Windows key code (0x46 is F, 0x02 is the right mouse button). The mode is one of these:
| Mode | Active when |
|---|---|
"hold" |
the key is held down |
"toggle" |
each press flips it on or off |
"always" |
always |
"click" |
for an instant on each press |
In the menu, a left click on the keybind picks a new key, and a right click picks the mode. If you give no key and no mode, the bind starts as "always", so the feature works until the user binds a key.
kb:ShowInKeybinds(label, toggleId) lists the bind in evasive's keybind list (Misc > Panels > Keybind list) while that toggle is on, and lights it up while the bind is active.
The keybind object also has :IsEnabled(), :GetKey(), :SetKey(key), :GetKeyName(), :GetType(), :SetType(mode) and :HideFromKeybinds().
Keys do not count while the user is typing in the menu or picking a key.
Putting it together
This script draws a circle around your cursor. Its tab turns it on and off, sets the size and colour, and gives it a hold key.
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local bind
UI.AddTab("Cursor ring", function(tab)
local sec = tab:Section("Ring", "Left")
sec:Toggle("ring_on", "Show ring", true)
sec:ColorPicker("ring_color", 1, 1, 1, 0.8)
bind = sec:Keybind("ring_key")
bind:ShowInKeybinds("Cursor ring", "ring_on")
sec:SliderInt("ring_radius", "Radius", 10, 400, 120)
sec:SliderInt("ring_sides", "Sides", 0, 64, 0)
sec:Tip("0 sides means as smooth as the size needs")
local info = tab:Section("About", "Right")
info:Text("Bind a key to show the ring only while you hold it.")
info:Button("Reset size", function()
UI.SetValue("ring_radius", 120)
end)
end)
local ring = Drawing.new("Circle")
ring.Thickness = 1.5
RunService.RenderStepped:Connect(function()
local on = UI.GetValue("ring_on") and bind ~= nil and bind.value
if not on then
ring.Visible = false
return
end
local color, alpha = UI.GetValue("ring_color")
ring.Color = color
ring.Transparency = alpha
ring.Radius = UI.GetValue("ring_radius")
ring.NumSides = UI.GetValue("ring_sides")
ring.Position = UserInputService:GetMouseLocation()
ring.Visible = true
end)bind is set the first time the tab function runs, which is the first frame after the script starts. Until then it is nil, which is why the check is there.
Removing a tab
UI.RemoveTab(name) takes a tab away while the script keeps running. A script can have several tabs, and all script tabs together can number up to 32.