Lernen
Engine-Klasse
StyleRule

*Dieser Inhalt wurde mit KI (Beta) übersetzt und kann Fehler enthalten. Um diese Seite auf Englisch zu sehen, klicke hier.


Zusammenfassung
Methoden
GetProperty(name: string):Variant
SetDefaultPropertyTransition(transitionParams: Variant):()
SetProperties(styleProperties: Dictionary):()
SetProperty(name: string,value: Variant):()
SetPropertyTransition(property: string,transitionParams: Variant):()
Geerbte Mitglieder

API-Referenz
Eigenschaften
Priority
Parallel lesen
Funktionen: UI
StyleRule.Priority:number

Selector
Parallel lesen
Funktionen: UI
StyleRule.Selector:string
Code-Beispiele
UI Klassenauswahl
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
-- Klassen-Selector
rule.Selector = "TextButton"
-- Regel-Eigenschaften festlegen
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 = "Hauptmenü"
button.Parent = screenGui
UI Tag-Auswahl
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-Auswahl
rule.Selector = ".ButtonPrimary"
-- Regel-Eigenschaften festlegen
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 = "Hauptmenü"
button.Parent = screenGui
-- Tag zum Button anwenden
CollectionService:AddTag(button, "ButtonPrimary")
UI-Modifikatorauswahl
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-Komponenten-Selector
rule.Selector = "Frame.RoundedCorner20::UICorner"
-- Regel-Eigenschaft festlegen
rule:SetProperty("CornerRadius", UDim.new(0, 20))
-- Rahmen erstellen
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0.4, 0, 0.2, 0)
frame.Parent = screenGui
-- Tag auf Rahmen anwenden
CollectionService:AddTag(frame, "RoundedCorner20")
UI Stil Abfrageauswahl
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
-- Deklariere Stilabfrageauswahlen
smallRule.Selector = "@Small"
mediumRule.Selector = "@Medium"
-- Setze Regel-Eigenschaften
smallRule:SetProperties({
["BackgroundColor3"] = Color3.fromHex("FF0099"),
["Text"] = "Kleiner Container",
["TextColor3"] = Color3.fromHex("E1E1E1"),
["TextSize"] = 12,
})
mediumRule:SetProperties({
["BackgroundColor3"] = Color3.fromHex("F0F0F0"),
["Text"] = "Mittlerer Container",
["TextColor3"] = Color3.fromHex("0022FC"),
["TextSize"] = 24,
})
local button = Instance.new("TextButton")
button.Text = "Hauptmenü"
button.Parent = screenGui
button.Size = UDim2.fromScale(0.5, 0.2)
-- Erstelle Stilabfragen mit Namen, die den Stilregel-Auswahlen entsprechen
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
Schreibgeschützt
Nicht repliziert
Parallel lesen
Funktionen: UI
StyleRule.SelectorError:string

Methoden
GetDefaultPropertyTransition
Funktionen: UI
StyleRule:GetDefaultPropertyTransition():Variant
Rückgaben
Variant

GetProperties
Funktionen: UI
StyleRule:GetProperties():Dictionary
Rückgaben

GetProperty
Funktionen: UI
StyleRule:GetProperty(name:string):Variant
Parameter
name:string
Rückgaben
Variant

GetPropertyTransitions
Funktionen: UI
StyleRule:GetPropertyTransitions():Dictionary
Rückgaben
Code-Beispiele
GetPropertyTransitions()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
-- Holen Sie sich eine Referenz zur Stilregel
local frameRule = coreSheet.Frame
-- Setzen Sie einige Übergänge
frameRule:SetPropertyTransition("BackgroundColor3", TweenInfo.new(1, Enum.EasingStyle.Linear))
frameRule:SetPropertyTransition("BackgroundTransparency", "$DefaultTransition")
local transitions = frameRule:GetPropertyTransitions()
print(transitions)

SetDefaultPropertyTransition
Funktionen: UI
StyleRule:SetDefaultPropertyTransition(transitionParams:Variant):()
Parameter
transitionParams:Variant
Rückgaben
()

SetProperties
Funktionen: UI
StyleRule:SetProperties(styleProperties:Dictionary):()
Parameter
styleProperties:Dictionary
Rückgaben
()

SetProperty
Funktionen: UI
StyleRule:SetProperty(
name:string, value:Variant
):()
Parameter
name:string
value:Variant
Rückgaben
()

SetPropertyTransition
Funktionen: UI
StyleRule:SetPropertyTransition(
property:string, transitionParams:Variant
):()
Parameter
property:string
transitionParams:Variant
Rückgaben
()
Code-Beispiele
SetPropertyTransition()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
-- Holen Sie sich eine Referenz zur Stilregel
local frameRule = coreSheet.Frame
-- Setzen Sie einen einsekündigen linearen Übergang für BackgroundColor3
frameRule:SetPropertyTransition("BackgroundColor3", TweenInfo.new(
1, -- Zeit
Enum.EasingStyle.Linear -- EasingStyle
))
-- Entfernen Sie den Übergang
frameRule:SetPropertyTransition("BackgroundColor3", nil)
SetPropertyTransition() Mit Tokens
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
local tokensSheet = ReplicatedStorage:FindFirstChild("Tokens")
-- Setze Tokens (Attribute) auf dem Tokens-Blatt
tokensSheet:SetAttribute("LinearTransition", TweenInfo.new(1, Enum.EasingStyle.Linear))
-- Hole Referenz zur Stilregel
local frameRule = coreSheet.Frame
frameRule:SetPropertyTransition("BackgroundColor3", "$LinearTransition")

SetPropertyTransitions
Funktionen: UI
StyleRule:SetPropertyTransitions(properties:Dictionary):()
Parameter
properties:Dictionary
Rückgaben
()
Code-Beispiele
SetPropertyTransitions()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
-- Zugriff auf die Stilregel erhalten
local frameRule = coreSheet.Frame
-- Setzt die Übergänge für zwei Eigenschaften auf einmal
frameRule:SetPropertyTransitions({
["BackgroundColor3"] = TweenInfo.new(1, Enum.EasingStyle.Linear),
["BackgroundTransparency"] = TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
})
-- Alle Übergänge entfernen
frameRule:SetPropertyTransitions({})
SetPropertyTransitions() Mit Tokens
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
local tokenSheet = ReplicatedStorage:FindFirstChild("Tokens")
-- Setzen Sie tokens (Attribute) auf dem Tokensheet
tokenSheet:SetAttribute("LinearTransition", TweenInfo.new(1, Enum.EasingStyle.Linear))
tokenSheet:SetAttribute("QuadTransition", TweenInfo.new(0.25, Enum.EasingStyle.Quad))
-- Holen Sie sich eine Referenz zur Stilregel
local frameRule = coreSheet.Frame
-- Setzen Sie Übergänge für mehrere Eigenschaften auf einmal
frameRule:SetPropertyTransitions({
["BackgroundColor3"] = "$LinearTransition",
["BackgroundTransparency"] = "$QuadTransition",
})

©2026 Roblox Corporation. Roblox, das Roblox-Logo und "Powering Imagination" gehören zu unseren eingetragenen und nicht eingetragenen Markenzeichen in den USA und anderen Ländern.