FANDOM


Responsible for all lighting aspects of the world (affects how things are rendered). This class cannot be instantiated.

Properties

Pubfield Color3 Ambient

The hue of the global lighting. Changing this changes the color tint of all objects in the Workspace.

Pubfield float Brightness

How much global light each Part in the Workspace receives. Standard range is 0 to 1 (0 being little light), but can be increased all the way to 5 (colors start to be appear very different at this value).

Pubfield float ClockTime

A float version of the TimeOfDay property.

Example:

local lighting = game:GetService("Lighting")
lighting.ClockTime = 4repeat
    lighting.ClockTime = lighting.ClockTime + 1    wait(1)
until lighting.ClockTime == 0print("It's midnight!")

Pubfield Color3 ColorShift_Bottom

The hue of global lighting on the bottom surfaces of an object.

Pubfield Color3 ColorShift_Top

The hue of global lighting on the top surfaces of an object.

Pubfield Color3 FogColor

A Color3 value that changes the hue of distance fog.

Pubfield float FogEnd

The distance at which fog completely blocks your vision. This distance is relative to the camera position. Units are in studs

Pubfield float FogStart

The distance at which the fog gradient begins. This distance is relative to the camera position. Units are in studs.

Pubfield float GeographicLatitude

The latitude position the level is placed at. This affects sun position.

Pubfield bool GlobalShadows

Flag enabling shadows from sun and moon in the place

Pubfield Color3 OutdoorAmbient

Effective ambient value for outdoors, effectively shadow color outdoors (requires GlobalShadows enabled)

Pubfield bool Outlines

Flag enabling or disabling outlines on parts and terrain

Pubfield Color3 ShadowColor [deprecated]

Color the shadows appear as. Shadows are drawn mostly for characters, but depending on the lighting will also show for Parts in the Workspace. Rendering settings can also affect if shadows are drawn.

Pubfield string TimeOfDay

A string that represent the current time of day. Time is in 24-hour clock format "hh:mm:ss".

Methods

Pubmethod double GetMinutesAfterMidnight()

The number of minutes that the current time is past midnight. If currently at midnight, returns 0. Will return decimal values if not at an exact minute.

Pubmethod Vector3 GetMoonDirection()

Returns the lookVector (Vector3) of the moon. If this lookVector was used in a CFrame, the Part would face the moon.

Pubmethod float GetMoonPhase()

Currently always returns 0.75. MoonPhase cannot be edited.

Pubmethod Vector3 GetSunDirection()

Returns the lookVector (Vector3) of the sun. If this lookVector was used in a CFrame, the Part would face the sun.

Pubmethod void SetMinutesAfterMidnight(double minutes)

Sets the time to be a certain number of minutes after midnight. This works with integer and decimal values.

Pubmethod double getMinutesAfterMidnight() [deprecated]

Pubmethod void setMinutesAfterMidnight(double minutes) [deprecated]

Events

Pubevent RBXScriptSignal LightingChanged(bool skyboxChanged)

Fired whenever a property of Lighting is changed, or a skybox is added or removed. Skyboxes are of type 'Sky' and should be parented directly to lighting.