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.