3 min read

Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.

Text & image buttons

GuiButtons are GuiObjects that allow players to perform an action. You can customize these buttons to provide context and feedback, such as changing the visual appearance or scripting audible feedback when a player interacts with a button.

There are two types of buttons which you can place on‑screen or in‑game:

Buttons on the screen

Buttons on the screen are useful to quickly guide players to various menus or pages. To add this type of button:

  1. In the Explorer window, hover over StarterGui, click the ⊕ button, and insert a ScreenGui.

  2. Hover over the new ScreenGui, click the ⊕ button, and insert either a TextButton or ImageButton.

Buttons on part faces

Buttons on a part are useful for allowing players to interact with parts. For example, you can let players step on a button to complete an action.

To add a button to the face of a part:

  1. In the Explorer window, hover over the part, click the ⊕ button, and insert a SurfaceGui.

  2. Hover over the new SurfaceGui, click the ⊕ button, and insert either a TextButton or ImageButton.

Note

If you don't see the button, try choosing a different face (Top, Bottom, Front, Back, Left, or Right) for the Face property of the SurfaceGui.

Button appearance

Both TextButton and ImageButton inherit from GuiObject which contains properties like BackgroundColor3, Rotation, and Size. Buttons also accept the appearance modifiers common to most UI objects.

Unique to TextButton are various properties to change its visual appearance:

An ImageButton has several properties to change its visual appearance, including hover and pressed image variants to indicate a player's interaction with the button:

Normal

<img src="https://prod.docsiteassets.roblox.com/assets/ui/button-text-input/ImageButton-State-Hover.png" />

Hover

<img src="https://prod.docsiteassets.roblox.com/assets/ui/button-text-input/ImageButton-State-Pressed.png" />

Pressed

Script buttons

You can script an action when a player presses a button by connecting the button to the GuiButton.Activated event, or to GuiButton.SecondaryActivated for cross‑platform secondary input like right‑click on desktop and long press on mobile. For example, when you parent the following LocalScript to a button, the button changes to a random color every time a player clicks/taps it.

local button = script.Parent
local RNG = Random.new()

local function onButtonActivated()
	-- Randomize the button color
	button.BackgroundColor3 = Color3.fromHSV(RNG:NextNumber(), 1, 1)
end

button.Activated:Connect(onButtonActivated)