Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Any way to find a player's quality level?

Asked by
Zerio920 285 Moderation Voter
8 years ago

My game contains a lot of moving parts (mostly decoration), causing lag in most people who play it. If I could find a way to find what quality level a player is set at, I could reduce the amount of these moving pieces accordingly. Like,

if player.qualitycontrol < 5 then
    movingpartsspawned = 10
end

Is this possible? If not, any other suggestions to reduce lag in a game?

1 answer

Log in to vote
2
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
8 years ago

There is! You can find the users initial quality level by calling the function UserSettings() and checking the value of it's property GameSettings's property SavedQualityLevel.

UserSettings().GameSettings.SavedQualityLevel.Value

However, you will have to keep track of changes to the quality level on your own. You can conveniently do this with an event of DataModel.

local CurrentGraphicsQualityLevel = UserSettings().GameSettings.SavedQualityLevel.Value

game.GraphicsQualityChangeRequest:connect(function(graphicsIncrease)
    local amount = graphicsIncrease and 1 or -1
    local level = CurrentGraphicsQualityLevel  + amount
    if level > 10 then
        level = 10
    elseif level < 1 then
        level = 1
    end
    CurrentGraphicsQualityLevel  = level
end)
0
UserSettings().GameSettings.SavedQualityLevel.Value returns 0 when the quality level is set to "Automatic". Haven't tried the code after that yet. Zerio920 285 — 8y
Ad

Answer this question