Hello
I am currently working on an ocean liner project where many of the interiors have to be lit. I noticed that while under low graphic settings, spaces appear well naturally lit (and mask the terrible lighting for low graphics) but when there is a graphics level above 6, the lighting changes and the space becomes extremely dark. My solution was to place lights inside, which helped make the space look more realistic at high graphics level but overly lit and way too bright at low graphics level. Is there any way I can put a script in the individual light models to set the brightness to 0 when the graphics level is below 6?
I don’t have any scripting knowledge so I used the AI assistant to write this script but I don’t know what to do with it. Could anyone help me out?
-- Get the point light
local light = script.Parent
-- Set a minimum graphics level
local minGraphicsLevel = 6
-- Function to adjust brightness based on graphics level
local function adjustBrightness()
-- Check the current graphics level
local graphicsLevel = game:GetService("UserGameSettings"):GetService("UserGameSettings").SavedQualitySetting
-- If the graphics level is below the minimum, set brightness to 0
if graphicsLevel < minGraphicsLevel then
light.Brightness = 0
end
end
-- Adjust brightness when the graphics quality changes
game:GetService("UserGameSettings").GraphicsQualityChangeRequest:Connect(adjustBrightness)
-- Adjust brightness on game start
adjustBrightness()
I edited the AI’s script so it would actually work. This script goes inside the light object:
-- Get the point light
local light = script.Parent
-- Set a minimum graphics level
local minGraphicsLevel = 6
-- Function to adjust brightness based on graphics level
local function adjustBrightness()
-- Check the current graphics level
local graphicsLevel = UserSettings().GameSettings.SavedQualityLevel.Value
-- If the graphics level is below the minimum, turn off the light
if graphicsLevel < minGraphicsLevel then
light.Enabled = false
else
light.Enabled = true
end
end
-- Adjust brightness when the graphics quality changes
UserSettings().GameSettings:GetPropertyChangedSignal("SavedQualityLevel"):Connect(adjustBrightness)
-- Adjust brightness on game start
adjustBrightness()
rather than adding the script to every light object you can can paste that code in a Local Script"inside of StarterPlayerScripts and give the tag Light to every light object
local CollectionService = game:GetService("CollectionService")
-- Set a minimum graphics level
local minGraphicsLevel = 6
-- Check the current graphics level
local function adjustBrightness()
local graphicsLevel = UserSettings().GameSettings.SavedQualityLevel.Value
-- If the graphics level is below the minimum, turn off the light
if graphicsLevel < minGraphicsLevel then
for _, light :Light in CollectionService:GetTagged("Light") do
light.Enabled = false
end
else
for _, light :Light in CollectionService:GetTagged("Light") do
light.Enabled = true
end
end
end
-- Adjust brightness when the graphics quality changes
UserSettings().GameSettings:GetPropertyChangedSignal("SavedQualityLevel"):Connect(adjustBrightness)