Lighting Setter Pack | Change the game's lighting easily!

Lighting Setter Pack v1.0.0


Hello! Have you ever wanted to make a system that changes lighting for your game with RNG maps?
Worry no more!

Lighting Setter is a system I’ve created for others to use! It is very very easy to use!
Let me show you how to use it…


Applying the lighting

First, get the Lighting Setter Pack model I’ve made.
Insert the model in workspace.
image
Open it, you should see a script and a configuration folder.
image
If you open the configuration folder, you will see alot of values
image
These are the settings of your lighting set.
DO NOT DELETE ANY OF THEM !

Open the “Base” script.


As you can see, it has 2 functions:

  • Updating the lighting
  • Saving the lighting

Now.

  1. Copy the UpdateLighting function.
  2. Create a script in workspace.
  3. Open it
  4. Paste the function into it.
local function UpdateLighting(required_pack : Folder)
	local Lighting = game:GetService("Lighting") -- Gets the service.
	local Pack = required_pack -- Gets the settings of our new Lighting.

	for i, val in ipairs(Pack:GetChildren()) do -- Iterates through the settings
		if val:IsA("ValueBase") then
			local HasProperty = pcall(function() -- Checks if the service has a property with the name like that
				local Prop = Lighting[val.Name]
			end)
			if HasProperty == true then
				Lighting[val.Name] = val.Value -- Change it if it does have one
			end
		end
	end
end

Once you’ve pasted it, you can put the yourLightingSet thing anywhere, but you will have to get the path to it later on.
Now paste this function into the same script

local Set = nil -- write the path to your lighting set (ex. workspace.LightingSet)

Now you must replace nil with the path to your lighting set
Paste this:

UpdateLighting(Set)

This will update the lighting to your set’s settings!


Saving the current lighting to a pack.

If your lazy to manually change the values, don’t worry! I gotchu!

Do this:

  1. Run the game.
  2. Put your lighting set in workspace
  3. Change the game’s lighting using the properties bar
  4. Run this Command in the Command Bar:
local function SaveCurrentLighting(pack) -- Must be ran in the command bar
	local Set = pack
	local Lighting = game:GetService("Lighting")
	if Set then
		for i, prop in ipairs(Set:GetChildren()) do
			if prop:IsA("ValueBase") then
				local getProp = pcall(function()
					local x = Lighting[prop.Name]
				end)
				if getProp == true then
					prop.Value = Lighting[prop.Name]
				end
			end
		end
	else
		error("No Lighting set found in workspace!")
	end
end
SaveCurrentLighting(workspace.YourPackGoesHere)
  1. replace YourPackGoesHere with the name of your pack.

Done! It should replace all the pack’s current settings to lighting’s!

Now. Select the updated pack and press Ctrl+C, then press the Stop button and press Ctrl+V
This will copy the updated pack, and then paste it in the workspace


Please note that I’m not the best explainer, I tried my best. Hope you understand :stuck_out_tongue:


Some QnA

  • Q: Can there be multiple lighting packs?
  • A: Yes

  • Q: Can I rename yourLightingPack to something else?
  • A: Obviously yes!

3 Likes

This is a very convenient resource! I thank you for releasing this to the community. :grin:

I have one suggestion. Could there be an option to tween the non-boolean properties of the lighting values as well, incase you would like to make an effect? :thinking:

My suggestion aside, this is definitely a resource I will use. Thank you very much for your contribution! :slight_smile:

Thanks for the idea! I will implement that in the future!

1 Like