Enum values don't work inside StyleSheet properties

When setting an enum property of an Instance you are able to use its numeric value:

MyInstance.AutomaticSize = 3

In the example above 3 would represent XY of the AutomaticSize enum (as shown in the docs).

However when attempting to do this via StyleSheet:SetProperty or StyleSheet:SetProperties it does not work.

local Gui = Instance.new("ScreenGui")
Gui.Parent = game:GetService("RunService"):IsServer() and
	game:GetService("StarterGui") or
	game:GetService("Players").LocalPlayer.PlayerGui

local Sheet = Instance.new("StyleSheet")
Sheet.Parent = Gui

local Rule = Instance.new("StyleRule")
Rule.Selector = "TextButton"
Rule:SetProperty("AutomaticSize", 3) -- This does not work.
Rule.Parent = Sheet

local Link = Instance.new("StyleLink")
Link.StyleSheet = Sheet
Link.Parent = Gui

local Btn = Instance.new("TextButton")
Btn.Parent = Gui

Expected behavior

I would expect that assigning 3 to the StyleSheet’s AutomaticSize property would assign the Enum.AutomaticSize.XY enum to the TextButton’s AutomaticSize property.

1 Like

Thanks for the report! We’ll follow up when we have an update for you.

2 Likes

Hi @MightyPart thanks for catching this issue, we will add to our backlog.

Please note that styling is not yet released publicly and the API is subject to changes before then. Thanks!

1 Like