Lighting
This is a MapLib Feature. It can be accessed by MapLib:GetFeature("Lighting")
.
Functions
SetLighting
Lighting:
SetLighting
(
properties:
{
[
string
]
:
any
}
,
postEffects:
{
[
string
]
:
{
[
string
]
:
any
}
}
) →
(
)
This function can to be used to change the lighting of a map mid round. We discourage usage of changing lighting
with game.Lighting[Property] = value
cause it doesnt replicate for spectators.
Example:
-- Changes the fog to 100 and the fog color to white
local LightingFeature = MapLib:GetFeature("Lighting")
LightingFeature:SetLighting({
FogEnd = 100,
FogColor = Color3.fromRGB(255, 255, 255)
})
info
This function also supports lighting effects to be updated and they will be replicated to specators.
-- Changes the fog to 100 and the fog color to white and makes everything monochrome.
local LightingFeature = MapLib:GetFeature("Lighting")
LightingFeature:SetLighting({
FogEnd = 100,
FogColor = Color3.fromRGB(255, 255, 255)
}, {
ColorCorrection = {
Saturation = -1,
},
})
caution
For the game to be able to edit post effects they have to be correctly placed inside the lighting folder inside settings. If they are created in a script the game will not see these and refuse to update the lighting properties.
tip
Since atmosphere instances don't have any enabled or disabled property we can get around that by parenting the instance to ReplicatedStorage and then we can parent it back to lighting when we need it.
local LightingFeature = MapLib:GetFeature("Lighting")
--Disables the atmosphere effect
LightingFeature:SetLighting({}, {
Atmosphere = {
Parent = game.ReplicateStorage,
},
})
task.wait(5)
--Enables the atmosphere effect
LightingFeature:SetLighting({}, {
Atmosphere = {
Parent = game.Lighting,
},
})