Section
Tab:NewSection(text)
Tab:NewSection("Main")
A bold heading that groups the elements below it.
KronHub v3 · Community tab
Write a single .lua file and it gets its own mini tab inside KronHub, with the same buttons, toggles, sliders, dropdowns, keybinds and text boxes the hub uses.
--@urlPut .lua files in your executor's workspace/KronHub/Community folder, or paste a raw link into Raw URL and press Import from URL.
Open the Community tab and press Load next to the script under Installed.
Its controls appear under Running. Click a card's header to collapse it. Press Unload to stop the script and remove its controls.
Scripts stay in the folder, so they're still listed the next time you open KronHub. Press Load to start one again.
Community scripts run with the same access as KronHub: files, HTTP and your account. Imported scripts update themselves from their URL every time you load them, so the author can change the code later.
Press Create Template in the Community tab. It writes workspace/KronHub/Community/Template.lua, which you can edit in any text editor. To reload after editing, press Unload and then Load.
--@name My Script
--@author YourName
--@version 1.0
--@description What your script does
local Tab, Hub = ...
Tab:NewSection("Main")
Tab:NewButton("Say hi", function()
Hub:Notify("My Script", "Hello!", 3)
end)
Tab:NewToggle("Example toggle", false, function(state)
print("Example toggle:", state)
end)
Tab is your card: everything you add shows up inside it, in the order you add it. Hub holds helpers like notifications. The method names and arguments are the same as KronHub's own tabs.
The first lines of the file describe the script. KronHub reads them to fill the Installed list without running your code.
--@name Wire Art
--@author YourName
--@version 1.0
--@description Draws pictures with wires
--@url https://raw.githubusercontent.com/you/repo/main/WireArt.lua
| Tag | Required | What it does |
|---|---|---|
--@name | Yes | Card and list title. Falls back to the file name. |
--@author | Yes | Shown as "by …". Falls back to "Unknown". |
--@version | No | Shown next to the name. |
--@description | No | Shown under the name in the Installed list. |
--@url | No | Raw link. KronHub downloads the latest version each time the script is loaded. |
| Method | Callback receives | Returns |
|---|---|---|
NewSection | – | – |
NewLabel | – | – |
NewButton | nothing | text label (set .Text) |
NewToggle | true / false | object with :Set() |
NewSlider | number | value box |
NewDropDown | picked option | object with list methods |
NewKeyBind | key name, e.g. "F" | – |
NewBox | current text | – |
Tab:NewSection(text)
Tab:NewSection("Main")
A bold heading that groups the elements below it.
Tab:NewLabel(text)
Tab:NewLabel("Some text")
A row of plain text.
Tab:NewButton(text, callback)
local button = Tab:NewButton("Start", function()
print("clicked")
end)
button.Text = "Stop"
Returnsthe button's text label. Change .Text to relabel it, for example for Start/Stop buttons.
Tab:NewToggle(text, default, callback)
local toggle = Tab:NewToggle("Auto chop", false, function(state)
print("on?", state)
end)
toggle:Set(true)
default = true starts it on and fires the callback once.
Returnsan object with :Set(state). Call :Set() with no argument to flip it.
Tab:NewSlider(text, default, min, max, precise, callback)
Tab:NewSlider("Speed", 16, 16, 100, false, function(value)
print(value)
end)
The callback fires once with default when the slider is created. precise = true allows one decimal place (12.5); false gives whole numbers. Players can also type a number into the box on the right.
Tab:NewDropDown(text, options, callback)
local trees = Tab:NewDropDown("Tree:", {"Oak", "Birch"}, function(choice)
print(choice)
end)
trees:Update("Walnut") -- add an option
trees:UpdateRemove("Birch") -- remove an option
trees:SetList({"Oak", "Koa"}) -- replace every option
trees:SetName("Tree: Oak") -- change the text on the box
Players can type into the box to search and press Enter to pick the top match. End the label with : because the box shows label choice after a pick, e.g. Tree: Oak.
The four-argument form NewDropDown(text, options, reset, callback) also works. Pass reset = false to show Selected: choice and highlight the picked option instead.
Tab:NewKeyBind(text, defaultKey, callback)
Tab:NewKeyBind("Toggle fly", Enum.KeyCode.F, function(key)
print(key, "pressed") -- "F"
end)
The default can be an Enum.KeyCode or a string like "F". Players click the box and press a key to rebind it.
Tab:NewBox(text, default, callback)
Tab:NewBox("Webhook", "", function(text)
print(text)
end)
The callback runs on every keystroke with the full current text.
When a player presses Unload, KronHub automatically:
Tab:ConnectTab:OnUnload functionsAnything else you start has to stop itself:
Tab:Connect(game:GetService("RunService").Heartbeat, function(dt)
-- disconnected automatically on unload
end)
Tab:OnUnload(function()
workspace.CurrentCamera.FieldOfView = 70 -- undo your changes here
end)
task.spawn(function()
while Tab:IsAlive() do -- stops when unloaded
task.wait(1)
end
end)
| Method | Use it for |
|---|---|
Tab:Connect(signal, fn) | Any event connection. Returns the connection. |
Tab:OnUnload(fn) | Undoing changes: restore settings, destroy parts you made. |
Tab:IsAlive() | Loop condition. false once the script is unloaded. |
Don't use while true do loops or plain :Connect calls. They keep running after unload, and run twice if the script is loaded again.
Hub:Notify("My Script", "Done!", 3)
local progress = Hub:Progress("Moving:", 25) -- shows "Moving: 0/25"
for i = 1, 25 do
progress:Update() -- 1/25, 2/25 … closes itself at 25/25
end
progress:Del() -- close it early
| Member | What it is |
|---|---|
Hub:Notify(title, text, seconds) | KronHub toast notification. |
Hub:Progress(title, total) | Progress toast. :Update() adds one, :Del() closes it. |
Hub.Kron | KronHub's internal helpers, e.g. Hub.Kron:callServer(name, ...), Hub.Kron:ForceNetworkOwnership(part), Hub.Kron:IsNetworkOwner(part), Hub.Kron:buyItem(name, amount). These can change between KronHub versions. |
Hub.Flags | Current values of KronHub's toggles, sliders and dropdowns, keyed by their label. Read only. |
Your script and every callback run in protected mode, so an error doesn't break KronHub. It's printed in the F9 console as:
[KronHub Community] <script name>: <error>
If the script errors while loading, its card is removed and a notification says it crashed. Syntax errors are reported the same way.
Upload the file somewhere with a raw link, such as GitHub raw or Pastebin raw.
Add --@url <that link> to the header. KronHub also adds it automatically on import.
Share the link. Players paste it into Raw URL and press Import from URL.
To ship an update, change the file at the same link. Players get it the next time they press Load.