Getting Started
To start your UI with PlatWare, use the following Lua code in a LocalScript:
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "PlatWareUI"
screenGui.Parent = player:WaitForChild("PlayerGui")
screenGui.ResetOnSpawn = false
local UI = require(yourUIlibModule) -- Require your UI library if saved in a ModuleScript
This will set up the main UI frame with a draggable top panel, minimize, and close buttons.
Creating a Category
Use UI:MakeCat()
to create a new category in the sidebar:
local charactersCat = UI:MakeCat({ Name = "Characters" })
This creates a category button in the sidebar and an empty frame to hold its contents.
Adding Labels
Inside a category, you can add simple text labels using AddLabel
:
charactersCat:AddLabel("Player Options")
Labels are non-interactive and simply display text inside the category.
Adding Buttons
Add clickable buttons with AddButton
:
charactersCat:AddButton({
Name = "Reset Character",
Callback = function()
print("Button clicked!")
end
})
The Callback
function will run whenever the button is clicked.
Adding Toggles
Create toggle buttons with AddToggle
:
charactersCat:AddToggle({
Name = "Enable Fly",
Default = false,
Callback = function(state)
print("Toggle is now", state and "ON" or "OFF")
end
})
The toggle text updates automatically to show [ON]
or [OFF]
.
Adding Sliders
You can add sliders to adjust numeric values:
charactersCat:AddSlider({
Name = "Speed",
Default = 50,
Max = 100,
Callback = function(value)
print("Slider value:", value)
end
})
The slider value updates while dragging the bar and calls the Callback
function with the current value.
Example Usage
local charactersCat = UI:MakeCat({ Name = "Characters" })
charactersCat:AddLabel("Player Options")
charactersCat:AddButton({
Name = "Reset Character",
Callback = function() print("Reset!") end
})
charactersCat:AddToggle({
Name = "Enable Fly",
Default = false,
Callback = function(state) print("Fly:", state) end
})
charactersCat:AddSlider({
Name = "Speed",
Default = 50,
Max = 100,
Callback = function(value) print("Speed:", value) end
})
This creates a fully functional "Characters" category with all UI elements.