Reference API Roblox

Engine API

Website

Related

Reference API Roblox

UIGradient

Applies a color and transparency gradient to the UI elements rendered by the parent GuiObject.

Member index 8

HistoryMember
731Color: ColorSequence
731Enabled: bool
731Offset: Vector2
731Rotation: float
732Scale: float
732TileMode: GradientTileMode
731Transparency: NumberSequence
732Type: GradientType
inherited from Instance
731Archivable: bool
731Capabilities: SecurityCapabilities
731IsInSandbox: bool
731Name: string
731Parent: Instance
731PredictionMode: PredictionMode
731Sandboxed: bool
731UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
707GetDescendants(): Instances
486GetFullName(): string
706GetStyled(name: string, selector: string?): Variant
657GetStyledPropertyChangedSignal(property: string): RBXScriptSignal
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
664IsPropertyModified(property: string): bool
698QueryDescendants(selector: string): Instances
573Remove(): null
576RemoveTag(tag: string): null
664ResetPropertyToDefault(property: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
731children(): Instances
731clone(): Instance
731destroy(): null
731findFirstChild(name: string, recursive: bool = false): Instance
731getChildren(): Instances
731isDescendantOf(ancestor: Instance): bool
731remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
657StyledPropertiesChanged()
731childAdded(child: Instance)
inherited from Object
731ClassName: string
731className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
731isA(className: string): bool
647Changed(property: string)

Description

UIGradient applies a color and transparency gradient to the UI elements rendered by the parent GuiObject. The appearance of the gradient is configurable through its Color (ColorSequence), Transparency (NumberSequence), Offset (Vector2), and Rotation (number).

A UIGradient will not apply to child or descendant GuiObjects. In order to apply the same gradient to multiple objects, you will need multiple gradient instances.

See also Appearance Modifiers for more information on UIGradient objects and how they work.

Supported Objects

You can apply gradients to Frame, TextLabel, TextButton, ImageLabel, ImageButton, and ViewportFrame. However, ScrollingFrame and TextBox are not currently supported.

Performance Considerations

In order to efficiently use a UIGradient, follow these principles:

  • Avoid using more than 6 color stops on the Color sequence.

  • Avoid using a UIGradient on any object that applies a text stroke (TextStrokeColor3), as the gradient will try to blend with strokes and borders, and may cause performance issues.

  • Avoid setting Color and Transparency frequently: this causes the sequence of colors to rebuild often, which is expensive. If possible, set these properties only once and try to animate the Offset or Rotation properties to achieve a similar effect. Alternatively, you can change the color of the parent GuiObject using such properties as BackgroundColor3, ImageColor3, or TextColor3.

  • When applying an unchanging gradient on a UI element whose state changes a lot, there is a tradeoff between using a UIGradient (processing time) and a static gradient image (memory).

History 40

Members 8

Color

TypeDefault
ColorSequence0 1 1 1 0 1 1 1 1 0

History 6

Enabled

TypeDefault
booltrue

History 6

Offset

TypeDefault
Vector20, 0

History 6

Rotation

TypeDefault
float0

History 6

Scale

TypeDefault
float1
This property is not browsable. It is not visible in Studio's object browser.

History 3

Tags: [NotBrowsable]

TileMode

TypeDefault
GradientTileModeClamp
This property is not browsable. It is not visible in Studio's object browser.

History 3

Tags: [NotBrowsable]

Transparency

TypeDefault
NumberSequence0 0 0 1 0 0

History 6

Type

TypeDefault
GradientTypeLinear
This property is not browsable. It is not visible in Studio's object browser.

History 3

Tags: [NotBrowsable]

Settings