Lighting Settings Loader

Untitled drawing - 2021-07-28T135140.840 (1) (3)

Lighting Settings Loader

About: Lighting Settings Loader
Hey everyone! Today I made a plugin that turns lighting settings into a Configuration folder and applies the settings using the Configuration at the press of a button! It uses attributes to store the properties of lighting, so it’s great for organizing settings. I got the idea from the comment below.

Showcase
Plugin Toolbar Picture

Explorer Picture

Instructions

  1. Get the plugin here: Lighting Settings Loader [BETA] - Roblox
  2. Press the “Store Configuration” button to create a Configuration with the settings. A folder will automatically be made in Lighting. Feel free to rename the Configuration, it will be selected after it’s created
  3. Select the Configuration before or after pressing the “Apply Configuration” button to apply the configuration
  4. That’s it! I hope y’all find this helpful! Let me know if you find any problems :+1:

Links
Plugin: Lighting Settings Loader [BETA] - Roblox
Source Code: pastebin.com/MM7JT8CC

7 Likes

I might sound silly but could I make a script that changes the lighting using the configurations at a certain time? (e.g. daytime lighting config will be put on when time is 06:00:00)

1 Like

Sure! The source code has a function that applies properties from a configuration’s attributes called apply. You can use that function and something like the code below to change the lighting:

local DAY_LENGTH = 10 --seconds
local Lighting = game:GetService("Lighting")

local nightConfiguration = Lighting.LightingConfigurations.Night
local dayConfiguration = Lighting.LightingConfigurations.Day

while true do
	apply(Lighting, dayConfiguration)
	wait(DAY_LENGTH)
	apply(Lighting, nightConfiguration)
	wait(DAY_LENGTH)
end

You can also create a tweening version of the apply function, probably something like this:

local TweenService = game:GetService("TweenService")

local function tween(instance, propertyName, propertyValue, time)
	local tweenInfo = TweenInfo.new(time, Enum.EasingStyle.Linear)
	local goal = {[propertyName] = propertyValue}
	local tween = TweenService:Create(instance, tweenInfo, goal)
	tween:Play()
	tween.Completed:Connect(function()
		tween:Destroy()
	end)
end

local function apply(instance, config, time)
	local attributes = config:GetAttributes()
	local attributeClassName = attributes["ClassName"]
	if attributeClassName ~= instance.ClassName then
		warn("Can't apply configuration to the wrong class! ["..instance.ClassName..","..attributeClassName.."]")
		return
	end
	attributes["ClassName"] = nil
	for attributeName, attributeValue in pairs(attributes) do
		instance[attributeName] = attributeValue
		tween(instance, attributeName, attributeValue, time)
	end
end

Feel free to PM me if you need anything else :+1:

2 Likes