PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

LightingChanged

This event fires when a Lighting property is changed or a Sky is added or removed from Lighting.

Although this event fires when most properties of Lighting are changed, developers should be aware of the few exceptions:

  • Changing Lighting/GlobalShadows will not fire this event
  • The fog properties, Lighting/FogColor, Lighting/FogStart and Lighting/FogEnd will not fire this event

In cases where this behavior is not desired, the Instance/Changed event or Instance/GetPropertyChangedSignal function can be used.

Parameters

Name Type Default Description

True if a Sky was inserted or removed, or the properties of a Sky changed.


Code Samples


Lighting.LightingChanged

The following code would print Skybox has changed whenever you changed the Lighting’s SkyBox. The opposite will be printed when the adverse is true.

game.Lighting.LightingChanged:Connect(function(skyboxChanged)
    if skyboxChanged then
       print("Skybox has changed")
    else
       print("The skybox did not change.")
    end
end)