An Enum value doesn’t have an event for firing when it is changed. Enum is similar to numbers and strings, and that they are just information/datatype.
I believe UserSettings have the Changed event and that the SavedQualityLevel is a property, so you should attach a Changed event to UserSettings. (Correct me if I’m wrong via message)
@Quwanterz Is correct, it has a Changed event, but it’s better to use GetPropertyChangedSignal so it only fires on the property you need
UserSettings().GameSettings:GetPropertyChangedSignal("SavedQualityLevel"):Connect(function()
if UserSettings().GameSettings.SavedQualityLevel.Value >= 5 then
print("ok")
end
end)
Is an example of how you’d do it with getting the Value property of an Enum, you can suit it to work with your needs
You can’t use Less than or equal to on Enums. On your enums you’re using for comparing, Level09 and Level10, add .Value after them, same goes for the current SavedQualityLevel, except for the Automatic statement, keep it as it is
I tested with 2 different codes. Here is the normal one:
local userSettings = UserSettings():GetService("UserGameSettings")
local qualityLevel = userSettings.SavedQualityLevel
userSettings.Changed:Connect(function()
if qualityLevel.Value <= Enum.QualityLevel.Level09.Value then
script.Parent.Lower.Visible = true
elseif qualityLevel.Value >= Enum.QualityLevel.Level10.Value then
script.Parent.Lower.Visible = false
script.Parent.Automatic.Visible = false
elseif qualityLevel == Enum.QualityLevel.Automatic then
script.Parent.Automatic.Visible = true
end
end)
And here a RenderStepped one: (if when starting game graphics are below 9 the UI will show, else if 10 then it won’t show. But changing the graphics don’t affect anything)
local userSettings = UserSettings():GetService("UserGameSettings")
local qualityLevel = userSettings.SavedQualityLevel
game:GetService("RunService").RenderStepped:Connect(function()
if qualityLevel.Value <= Enum.QualityLevel.Level09.Value then
script.Parent.Lower.Visible = true
elseif qualityLevel.Value >= Enum.QualityLevel.Level10.Value then
script.Parent.Lower.Visible = false
script.Parent.Automatic.Visible = false
elseif qualityLevel == Enum.QualityLevel.Automatic then
script.Parent.Automatic.Visible = true
end
end)