Learn
Engine Class
StyleRule

Summary
Methods
GetProperty(name: string):Variant
SetDefaultPropertyTransition(transitionParams: Variant):()
SetProperties(styleProperties: Dictionary):()
SetProperty(name: string,value: Variant):()
SetPropertyTransition(property: string,transitionParams: Variant):()
Inherited Members

API Reference
Properties
Priority
Read Parallel
Capabilities: UI
StyleRule.Priority:number

Selector
Read Parallel
Capabilities: UI
StyleRule.Selector:string
Code Samples
UI Class Selector
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local screenGui = script.Parent
local coreSheet = Instance.new("StyleSheet")
coreSheet.Parent = ReplicatedStorage
local styleLink = Instance.new("StyleLink")
styleLink.StyleSheet = coreSheet
styleLink.Parent = screenGui
local rule = Instance.new("StyleRule")
rule.Parent = coreSheet
-- Class selector
rule.Selector = "TextButton"
-- Set rule properties
rule:SetProperties({
["BackgroundColor3"] = Color3.fromHex("335FFF"),
["TextColor3"] = Color3.fromHex("E1E1E1"),
["Size"] = UDim2.new(0.15, 0, 0, 40),
["BorderSizePixel"] = 0,
})
local button = Instance.new("TextButton")
button.Text = "Main Menu"
button.Parent = screenGui
UI Tag Selector
local CollectionService = game:GetService("CollectionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local screenGui = script.Parent
local coreSheet = Instance.new("StyleSheet")
coreSheet.Parent = ReplicatedStorage
local styleLink = Instance.new("StyleLink")
styleLink.StyleSheet = coreSheet
styleLink.Parent = screenGui
local rule = Instance.new("StyleRule")
rule.Parent = coreSheet
-- Tag selector
rule.Selector = ".ButtonPrimary"
-- Set rule properties
rule:SetProperties({
["BackgroundColor3"] = Color3.fromHex("FF0099"),
["TextColor3"] = Color3.fromHex("E1E1E1"),
["Size"] = UDim2.new(0.15, 0, 0, 40),
["BorderSizePixel"] = 0,
})
local button = Instance.new("TextButton")
button.Text = "Main Menu"
button.Parent = screenGui
-- Apply tag to button
CollectionService:AddTag(button, "ButtonPrimary")
UI Modifier Selector
local CollectionService = game:GetService("CollectionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local screenGui = script.Parent
local coreSheet = Instance.new("StyleSheet")
coreSheet.Parent = ReplicatedStorage
local styleLink = Instance.new("StyleLink")
styleLink.StyleSheet = coreSheet
styleLink.Parent = screenGui
local rule = Instance.new("StyleRule")
rule.Parent = coreSheet
-- UI component selector
rule.Selector = "Frame.RoundedCorner20::UICorner"
-- Set rule property
rule:SetProperty("CornerRadius", UDim.new(0, 20))
-- Create frame
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0.4, 0, 0.2, 0)
frame.Parent = screenGui
-- Apply tag to frame
CollectionService:AddTag(frame, "RoundedCorner20")
UI Style Query Selector
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local screenGui = script.Parent
local coreSheet = Instance.new("StyleSheet")
coreSheet.Parent = ReplicatedStorage
local styleLink = Instance.new("StyleLink")
styleLink.StyleSheet = coreSheet
styleLink.Parent = screenGui
local smallRule = Instance.new("StyleRule")
smallRule.Parent = coreSheet
local mediumRule = Instance.new("StyleRule")
mediumRule.Parent = coreSheet
-- Declare style query selectors
smallRule.Selector = "@Small"
mediumRule.Selector = "@Medium"
-- Set rule properties
smallRule:SetProperties({
["BackgroundColor3"] = Color3.fromHex("FF0099"),
["Text"] = "Small Container",
["TextColor3"] = Color3.fromHex("E1E1E1"),
["TextSize"] = 12,
})
mediumRule:SetProperties({
["BackgroundColor3"] = Color3.fromHex("F0F0F0"),
["Text"] = "Medium Container",
["TextColor3"] = Color3.fromHex("0022FC"),
["TextSize"] = 24,
})
local button = Instance.new("TextButton")
button.Text = "Main Menu"
button.Parent = screenGui
button.Size = UDim2.fromScale(0.5, 0.2)
-- Create style queries with names matching style rule selectors
local mediumSQ = Instance.new("StyleQuery")
mediumSQ.Parent = button
mediumSQ.Name = "Medium"
mediumSQ:SetConditions({
["MinSize"] = Vector2.new(200, 0),
})
local smallSQ = Instance.new("StyleQuery")
smallSQ.Parent = button
smallSQ.Name = "Small"
smallSQ:SetConditions({
["MaxSize"] = Vector2.new(200, math.huge),
["MinSize"] = Vector2.new(0, 0),
})

SelectorError
Read Only
Not Replicated
Read Parallel
Capabilities: UI
StyleRule.SelectorError:string

Methods
GetDefaultPropertyTransition
Capabilities: UI
StyleRule:GetDefaultPropertyTransition():Variant
Returns
Variant

GetProperties
Capabilities: UI
StyleRule:GetProperties():Dictionary
Returns

GetProperty
Capabilities: UI
StyleRule:GetProperty(name:string):Variant
Parameters
name:string
Returns
Variant

GetPropertyTransitions
Capabilities: UI
StyleRule:GetPropertyTransitions():Dictionary
Returns
Code Samples
GetPropertyTransitions()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
-- Get reference to style rule
local frameRule = coreSheet.Frame
-- Set some transitions
frameRule:SetPropertyTransition("BackgroundColor3", TweenInfo.new(1, Enum.EasingStyle.Linear))
frameRule:SetPropertyTransition("BackgroundTransparency", "$DefaultTransition")
local transitions = frameRule:GetPropertyTransitions()
print(transitions)

SetDefaultPropertyTransition
Capabilities: UI
StyleRule:SetDefaultPropertyTransition(transitionParams:Variant):()
Parameters
transitionParams:Variant
Returns
()

SetProperties
Capabilities: UI
StyleRule:SetProperties(styleProperties:Dictionary):()
Parameters
styleProperties:Dictionary
Returns
()

SetProperty
Capabilities: UI
StyleRule:SetProperty(
name:string, value:Variant
):()
Parameters
name:string
value:Variant
Returns
()

SetPropertyTransition
Capabilities: UI
StyleRule:SetPropertyTransition(
property:string, transitionParams:Variant
):()
Parameters
property:string
transitionParams:Variant
Returns
()
Code Samples
SetPropertyTransition()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
-- Get reference to style rule
local frameRule = coreSheet.Frame
-- Set a 1-second linear transition on BackgroundColor3
frameRule:SetPropertyTransition("BackgroundColor3", TweenInfo.new(
1, -- Time
Enum.EasingStyle.Linear -- EasingStyle
))
-- Remove the transition
frameRule:SetPropertyTransition("BackgroundColor3", nil)
SetPropertyTransition() Using Tokens
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
local tokensSheet = ReplicatedStorage:FindFirstChild("Tokens")
-- Set tokens (attributes) on tokens sheet
tokensSheet:SetAttribute("LinearTransition", TweenInfo.new(1, Enum.EasingStyle.Linear))
-- Get reference to style rule
local frameRule = coreSheet.Frame
frameRule:SetPropertyTransition("BackgroundColor3", "$LinearTransition")

SetPropertyTransitions
Capabilities: UI
StyleRule:SetPropertyTransitions(properties:Dictionary):()
Parameters
properties:Dictionary
Returns
()
Code Samples
SetPropertyTransitions()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
-- Get reference to style rule
local frameRule = coreSheet.Frame
-- Sets transitions for two properties at once
frameRule:SetPropertyTransitions({
["BackgroundColor3"] = TweenInfo.new(1, Enum.EasingStyle.Linear),
["BackgroundTransparency"] = TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
})
-- Remove all transitions
frameRule:SetPropertyTransitions({})
SetPropertyTransitions() Using Tokens
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
local tokenSheet = ReplicatedStorage:FindFirstChild("Tokens")
-- Set tokens (attributes) on token sheet
tokenSheet:SetAttribute("LinearTransition", TweenInfo.new(1, Enum.EasingStyle.Linear))
tokenSheet:SetAttribute("QuadTransition", TweenInfo.new(0.25, Enum.EasingStyle.Quad))
-- Get reference to style rule
local frameRule = coreSheet.Frame
-- Set transitions for multiple properties at once
frameRule:SetPropertyTransitions({
["BackgroundColor3"] = "$LinearTransition",
["BackgroundTransparency"] = "$QuadTransition",
})

©2026 Roblox Corporation. Roblox, the Roblox logo and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.