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.
Open it, you should see a script and a configuration folder.
If you open the configuration folder, you will see alot of values
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.
- Copy the UpdateLighting function.
- Create a script in workspace.
- Open it
- 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:
- Run the game.
- Put your lighting set in workspace
- Change the game’s lighting using the properties bar
- 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)
- 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
Some QnA
- Q: Can there be multiple lighting packs?
- A: Yes
- Q: Can I rename yourLightingPack to something else?
- A: Obviously yes!