Why use TextButton?
TextButton is an interactive GUI element. Activated is a useful event for mouse, touch, and gamepad activation, while game-changing requests still need server validation.
Try it in Roblox Studio
Create StarterGui > PracticeGui (ScreenGui) > StartButton (TextButton), then put this LocalScript inside StartButton. Run a Studio client and press the button.
Syntax
button.Activated:Connect(function() ... end)Examples
TextButton actions
Update a button label when it is activated.
local button = script.Parent
assert(button:IsA("TextButton"))
button.Activated:Connect(function()
button.Text = "Starting..."
print("Start button activated")
end)- The LocalScript runs in the player interface and references its parent button.
- Activated is inherited from GuiButton and fires for supported activation methods.
- Changing Text only updates the local interface. Starting a shared match would require a validated server request.
Best practices
- Prefer Activated for a button intended to work across input types.
- Do not treat a client click as proof that a server-side action is allowed.
Runtime & versions
Luau host; Roblox engine examples require Roblox Studio. Feature availability depends on the language and runtime version used by your project; consult the official reference below.
Luau documentation