I want to make it so when a player has low graphics in my game, a GUI will pop up saying the game will not work with graphics lower than 3.
This issue stems from the weird problem where the 2D camera script I’m using doesn’t let lights appear with graphics under 3.
I’ve gotten the script to mostly work, I just need to make it so the script detects the number value. When I tried to make it run, the script was able to detect when a player changed their graphics but then it gave me this error:
16:07:56.936 Players.bringtixbackalready.PlayerGui.GraphicsFrame.Handler:6: attempt to compare EnumItem <= EnumItem
How can I make it so the script knows the number of graphics and can discern the value of it? Ex: QualityLevel3 < QualityLevel5
local GameSettings = UserSettings():GetService("UserGameSettings")
local Graphics = GameSettings.SavedQualityLevel
local GraphicsSettings = Enum.SavedQualitySetting:GetEnumItems()
local function onGameSettingChanged()
while task.wait() do
if Graphics <= Enum.SavedQualitySetting.QualityLevel3 then
script.Parent.Enabled = false
else
script.Parent.Enabled = true
end
end
end
GameSettings.Changed:Connect(onGameSettingChanged)```
You need to turn it into a string remove the extra and then turn it into a number
LevelEnum = UserSettings().GameSettings.SavedQualityLevel
StringEnum = tostring(LevelEnum)
Result = string.gsub(StringEnum,"Enum.SavedQualitySetting.QualityLevel","")
Result2 = tonumber(Result)
if StringEnum ~= "Enum.SavedQualitySetting.Automatic" then
if Result2 > YourNumber then
-- Your script
end
else
return warn("Quality was automatic")
end
EnumItems have a .Value property, in this case they’re set accordingly to their number,
local GameSettings = UserSettings():GetService("UserGameSettings")
local function onGameSettingChanged()
local Graphics = GameSettings.SavedQualityLevel
if Graphics.Value == 0 then
return -- Automatic, set according to how you want to
end
script.Parent.Enabled = Graphics.Value < 3
end
GameSettings:GetPropertyChangedSignal("SavedQualityLevel"):Connect(onGameSettingChanged)
It’s nice that your script is more concise than mine, but it still gives a similar error.
17:22:38.173 Players.bringtixbackalready.PlayerGui.GraphicsFrame.Handler:8: attempt to compare EnumItem < number
Edit: While playtesting the script, I found that if the player plays with graphics lower than 3, the script will not notice it and only make the GUI pop up if they change their graphics. (less than 3)
That’s simple, run onGameSettingChanged below the GetPropertyChangedSignal line
local GameSettings = UserSettings():GetService("UserGameSettings")
local function onGameSettingChanged()
local Graphics = GameSettings.SavedQualityLevel
if Graphics.Value == 0 then
return -- Automatic, set according to how you want to
end
script.Parent.Enabled = Graphics.Value < 3
end
GameSettings:GetPropertyChangedSignal("SavedQualityLevel"):Connect(onGameSettingChanged)
onGameSettingChanged()