One service, three input primitives: Slider (drag), Text (focus), and Switch (toggle). Each attaches to an existing Roblox GUI hierarchy and fires a callback with the current value.
InputsService expects you to have already built the GUI hierarchy in Studio. Each function receives the root container and wires up all input logic, tweens, and cleanup internally. Connections are automatically disconnected when the root instance leaves the DataModel via AncestryChanged.
Slider() tracks MouseMovement across the track's absolute width and converts it to a 0–100 integer. An invisible InputSink TextButton is injected into the track during a drag so no other GUI elements steal input.
Properties
InputsService.Slider(script.Parent.SliderFrame, function(value)
print("Value:", value) -- 0–100, step 1
end)Wiring up a Slider
Advanced — live-update a TextLabel with the value
Text() tweens a UIStroke from its default color to the SlateUI active color (slate-600, RGB 71 85 105) when the TextBox gains focus, and restores it on FocusLost. The callback receives both the final text and a boolean indicating whether Enter was pressed.
focused = false
Properties
InputsService.Text(script.Parent.InputFrame, function(text: string, submitted: boolean)
if submitted then print("Submitted:", text) end
end)Wiring up a Text input
Advanced — validate on submit, show error stroke
Switch() toggles a boolean state on each MouseButton1 click. It tweens the Knob between two named position anchors (OnTarget and OffTarget) and tweens the UIStroke to the active color when on.
state = false
Properties
InputsService.Switch(script.Parent.SwitchFrame, function(state: boolean)
print("Switch →", state)
end)Wiring up a Switch
Advanced — drive a setting from a switch
| Prop | Type | Default | Description |
|---|---|---|---|
| InputsService.Slider | (track: Frame, callback: (value: number) -> ()) | — | Attaches drag logic to track. Requires a Knob child. Fires callback with 0–100. |
| InputsService.Text | (frame: Frame, callback: (text: string, submitted: boolean) -> ()) | — | Requires Input (TextBox) and UIStroke children. Fires callback on FocusLost. |
| InputsService.Switch | (frame: Frame, callback: (state: boolean) -> ()) | — | Requires Knob, UIStroke, OnTarget, and OffTarget children. |