Class · inherits GuiButton
ImageButton
A 2D user interface element that displays an interactive image.
About ImageButton
An ImageButton behaves similarly to an ImageLabel in regards
to rendering, with the additional behaviors of a GuiButton.
Properties 16
HoverImage
: ContentIdA texture ID that will be used when theImageButtonis being hovered.HoverImageContent
: ContentThe image content that will be used when theImageButtonis being hovered. Only supports asset URIs.An image-type Content that can be set as an
ImageButtonproperty. When the button is hovered, it will render this image. Only asset URIs are supported for this property.Image
: ContentIdThe image content displayed by theImageButtonelement. Reads and writes toImageContent.This property is a content-type property that should hold the asset ID of a decal or image uploaded to Roblox. It functions identically to
Decal.Texturewith regards to loading the image from Roblox. The rendered image will be colorized usingImageColor3.Note that it is possible to make the image render as tiled, scaled to fit, or 9-sliced by adjusting the
ScaleTypeproperty.ImageColor3
: Color3Determines how a rendered image will be colorized.This property determines how an image is colorized. When set to white, no colorization occurs. This property is very useful for reusing image assets: If the source image is completely white with transparency, you can set the entire color of the image at once with this property.
ImageContent
: ContentThe image content displayed by the UI element. Supports asset URIs andEditableImageobjects.This property should hold an asset URI or a reference to an
EditableImageobject. The asset URI can reference a decal or image uploaded to Roblox. It functions identically toDecal.Texturewith regards to loading the image.The rendered image will be colorized using
ImageColor3. It is possible to make the image render as tiled, scaled to fit, or 9‑sliced by adjusting theScaleTypeproperty.ImageRectOffset
: Vector2The offset in pixels of the sub-area of an image to be displayed.This property determines the pixel offset (from the top-left) of the image area to be displayed, allowing for the partial display of an image in conjunction with
ImageRectSize.ImageRectSize
: Vector2Determines the size in pixels of the sub-area of an image to be displayed.This property determines the pixel size of the image area to be displayed, allowing for the partial display of an image in conjunction with
ImageRectOffset. If either dimension is set to0, the entire image is displayed instead.ImageTransparency
: floatDetermines the transparency of the rendered image.This property determines the alpha of the element's rendered image. A value of
0is completely opaque and a value of1is completely transparent (invisible). This property behaves similarly toGuiObject.BackgroundTransparencyorBasePart.Transparency.If you disable image rendering by setting
ImageTransparencyto1, it will result in a plain rectangle that can be used as a button. However, it may be better to use a blankTextButtoninstead.IsLoaded
: booleanReadOnlyNotReplicatedIndicates whether the Image has finished loading from the Roblox website.This property indicates if the
Imageproperty has finished loading from Roblox. Images declined by moderation will never load.PressedImage
: ContentIdA texture ID that will be used when anImageButtonis being pressed.A texture ID that can be set as an
ImageButtonproperty. When the button is pressed, it will render this image.PressedImageContent
: ContentThe image content that will be used when anImageButtonis being pressed. Only supports asset URIs.An image-type Content that can be set as an
ImageButtonproperty. When the button is pressed, it will render this image. Only asset URIs are supported for this property.ResampleMode
: ResamplerModeSelects the image resampling mode for the button.Determines how the image looks when it is scaled. By default, the image smooths out the texture when displayed either larger or smaller than its size in texture memory. In contrast,
Enum.ResamplerMode.Pixelatedpreserves the sharp edges of the image pixels.ScaleType
: ScaleTypeDetermines how an image will scale if displayed in a UI element whose size differs from the source image.This property determines in what way the
Imageproperty is rendered when the UI element's absolute size differs from the source image's size.By default, this property is
Enum.ScaleType.Stretchwhich will simply stretch/compact the image dimensions so it fits the UI element's space exactly. Since transparent pixels are set to black when uploading to Roblox, transparent images should apply alpha blending to avoid a blackish outline around scaled images.For
ScaleType.Slice, when scaling up, the corners will remain the source image size. The edges of the image will stretch to the width/height of the image. Finally, the center of the image will stretch to fill the center area of the image. To learn more about 9‑sliced images, see UI 9‑Slice Design.For
ScaleType.Tile, the size of each image tile is determined by theTileSizeproperty.SliceCenter
: RectSets the slice boundaries of a 9-sliced image.This property sets the slice boundaries of a 9-sliced image when
ScaleTypeis set toEnum.ScaleType.Slice.To learn more about 9‑sliced images, see UI 9‑Slice Design.
SliceScale
: floatScales the 9-slice edges by the specified ratio.Scales the 9-slice edges by the specified ratio. This means that the edges around the 9‑slice will grow as if you'd uploaded a new version of the texture upscaled. Defaults to
1.0.As a multiplier for the borders of a 9-slice, it is useful for reusing one rounded corner image for multiple radii.
See also
ScaleTypewhich determines how an image will scale if displayed in a UI element whose size differs from the source image.TileSize
: UDim2Sets the tiling scale of the ImageButton.Sets the tiling size of the
ImageButtonstarting at the upper-left corner of the image. The defaultUDim2values are1, 0, 1, 0; the scale components of theUDim2will scale the tile based on the size of theImageButtonwhile the offset components are in raw pixels. For example, a scale of0.5means the tile will be half the size of theImageButtonin the corresponding axis.This property is only active if the
ScaleTypeproperty is set toScaleType.Tile.
ImageButton also has every member of GuiButton. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.