Developer Cheat‑Sheet
Browse, copy & paste. Each snippet includes a short description so you instantly know where it fits.
-
Library
Pulls in the latest
Lib
object from our CDN so you always run the newest UI/utility stack.-- Load the Library local Library = loadstring(game:HttpGet("https://versusairlines.top/scripts/NewLibrary.lua"))()
-
Setup
Initialises the UI. Returns a window controller you’ll use to build sections & widgets.
local ui = Library:Setup({ Location = game.CoreGui, -- parent instance for the ScreenGui OpenCloseLocation = "Top Center" -- button position })
-
CreateSection
Adds a collapsible pane (appears in the left nav). Widgets created from this section land in its right‑side body.
local versusSection = ui:CreateSection("Versus") local airlinesSection = ui:CreateSection("Airlines")
-
createLabel
Static text element – great for instructions or status read‑outs.
versusSection:createLabel({ Name = "Simple Label", Description = "Displays text on the UI." })
-
createButton
Clickable action. Use Library flags or your own state to guard execution.
versusSection:createButton({ Name = "Vague Button", Description = "Needs 'Normal Toggle' active to respond.", Callback = function() if Library.Flags["Jimbo"] then print("Hello!!") else warn("Error: 'Normal Toggle' is off.") end end, })
-
createToggle
Boolean switch that auto‑persists via
Library.Flags
. Every change hits yourCallback
.versusSection:createToggle({ Name = "Normal Toggle", Flag = false, flagName = "Jimbo", Callback = function(v) print("Toggle:", v) end, })
-
createSlider
Continuous numeric input (min‑max). Drag or type – value stays in
Flags[flagName]
.versusSection:createSlider({ Name = "Speed", Description = "WalkSpeed (1‑100)", flagName = "Speed", minValue = 1, maxValue = 100, Callback = function(v) game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = v end, })
-
createInputBox
Free‑text / number entry with automatic storage.
versusSection:createInputBox({ Name = "Jump Power", flagName = "Jump", Flag = 50, Callback = function(v) game.Players.LocalPlayer.Character.Humanoid.JumpHeight = tonumber(v) end, })
-
createDropdown
Single‑ or multi‑select list. The helper it returns lets you refresh options on the fly.
local dropdown = airlinesSection:createDropdown({ Name = "Crew", flagName = "CrewDrop", Flag = {"Samantha"}, List = {"Samantha","Emma","Daisy","Timmy"}, multi = true, Callback = print, }) -- hot‑swap the menu later: dropdown:updateList({"Ava","Olivia","Mia"})
-
UpdateUI
Changes the whole colour theme at runtime. Pre‑built themes:
"Light Mode"
,"Dark Mode"
,"Halloween"
, or your saved"Custom"
.ui:UpdateUI("Dark Mode")
-
PlaySound
Plays UI SFX when
DisableSounds
is false. Defaults include"Click"
&"Pop"
.Library.DisableSounds = false Library:PlaySound("Click")
-
TrackConnection & Cleanup
Assign a tag to any
RBXScriptConnection
so you can nuke it later or when the UI closes.local conn = workspace.Changed:Connect(function() end) Library:TrackConnection(conn,"Temp") ... Library:CleanupConnectionsByTag("Temp")
-
Flags & Persistence
All widget states end up in
Library.Flags
. They auto‑save to Versus Airlines 2.0/saves.json per‑game.print(Library.Flags)
-
isClosed
Handy check inside render loops (returns true when the main window is hidden).
if Library.isClosed() then print("UI hidden – pause heavy stuff") end
-
Template – Toggle + RenderStepped Loop
Runs every frame while the toggle is on — and instantly cleans up when off.
versusSection:createToggle({ Name = "Normal Toggle", Flag = false, flagName = "Jimbo", Callback = function(enabled) Library:CleanupConnectionsByTag("AutoJimbo") if enabled then local conn = RunService.RenderStepped:Connect(function() if not Library.Flags["Jimbo"] then return end print("'Normal Toggle' flag is enabled!") end) Library:TrackConnection(conn,"AutoJimbo") end end, })
-
Template – Toggle + Throttled Heartbeat
Similar to above but fires every 2 seconds using
tick()
.versusSection:createToggle({ Name = "Jimbo With Waiting", Flag = false, flagName = "waitJimbo", Callback = function(enabled) Library:CleanupConnectionsByTag("AutowaitJimbo") if enabled then local last = 0 local conn = RunService.Heartbeat:Connect(function() if not Library.Flags["waitJimbo"] then return end if tick() - last >= 2 then print("Jimbo tick!") last = tick() end end) Library:TrackConnection(conn,"AutowaitJimbo") end end, })
-
Template – Speed Boost Slider
Pair a toggle & slider so users can enable and tune a WalkSpeed boost.
local speedToggle = versusSection:createToggle({ Name = "Speed Boost", flagName = "RunToggle", Flag = false, }) versusSection:createSlider({ Name = "Boost Amount", flagName = "BoostValue", minValue = 16, maxValue = 100, Flag = 50, Callback = function(v) if Library.Flags.RunToggle then game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = v end end, })
-
Template – Dynamic Dropdown
Refreshes the list every 5 sec to match current players, without reopening the UI.
local dd = versusSection:createDropdown({ Name = "Players", flagName = "PlayerDrop", List = {}, }) local function refresh() local names = {} for _,plr in ipairs(game.Players:GetPlayers()) do table.insert(names,plr.Name) end dd:updateList(names) end refresh() Library:TrackConnection(game.Players.PlayerAdded:Connect(refresh),"PlayersDD") Library:TrackConnection(game.Players.PlayerRemoving:Connect(refresh),"PlayersDD")