Service · inherits Instance
Lighting
The Lighting service controls global lighting in an experience. It includes
a range of adjustable properties that you can use to change how lighting
appears and interacts with other objects.
About Lighting
The Lighting service controls global lighting in an experience. It includes
a range of adjustable properties that you can use to change how lighting
appears and interacts with other objects, as summarized in
Lighting Properties.
Lighting may also contain an Atmosphere object to render realistic
atmospheric effects, including particle density, haze, glare, and color. See
Atmospheric Effects for details.
In addition, Lighting (along with Workspace.CurrentCamera) may
contain
post‑processing effects
such as SunRaysEffect and BlurEffect.
Properties 19
Ambient
: Color3The lighting hue applied to areas that are occluded from the sky, such as indoor areas.Ambientis the lighting hue applied to areas that are occluded from the sky, such as indoor areas.Ambientdefaults to[0, 0, 0](black). As long as the red, green, and blue channels of this property do not exceed the corresponding channels inOutdoorAmbient, the change in hue will be reserved for areas occluded from the sun/moon.Note that when
GlobalShadowsis disabled, there is no distinction between areas occluded from the sky and non‑occluded areas. In this case,OutdoorAmbientwill be ignored and the hue from theAmbientproperty will be applied everywhere.Brightness
: floatThe intensity of illumination in the place.The intensity of illumination in the place.
Changing this value will influence the impact of the light source (sun or moon) on the place's lighting. Note that
AmbientandOutdoorAmbientcan also be used to influence how bright a place appears. For example, settingOutdoorAmbientto[255, 255, 255]will make the place appear brighter than its default value of127, 127, 127(as it is more white).ClockTime
: floatNotReplicatedA numerical representation (in hours) of the current time of day used byLighting.A numerical representation (in hours) of the current time of day used by
Lighting. Note that this property does not correspond with the actual time of day and will not change during gameplay unless it has been changed by a script.For a measure of
Lightingtime formatted as a 24-hour string, useTimeOfDay. ChangingTimeOfDayor usingSetMinutesAfterMidnight()will also change this property.ColorShift_Bottom
: Color3The hue represented in light reflected in the opposite surfaces to those facing the sun or moon.The hue represented in light reflected in the opposite surfaces to those facing the sun or moon.
The surfaces of a
BasePartinfluenced byColorShift_Bottomdepends on the position and orientation of theBasePartrelative to the sun or moon's position. Where the sun is directly overhead aBasePart, the shift in color will only apply to the bottom surface.This effect can be increased or reduced by altering
Brightness.Note that
ColorShift_TopandColorShift_Bottomwill interact with theAmbientandOutdoorAmbientproperties if they are greater than[0, 0, 0]. Also note that the influence ofColorShift_Bottomcan be very hard to identify whenGlobalShadowsis enabled (default).ColorShift_Top
: Color3The hue represented in light reflected from surfaces facing the sun or moon.The hue represented in light reflected from surfaces facing the sun or moon.
The surfaces of a
BasePartinfluenced byColorShift_Topdepends on the position and orientation of theBasePartrelative to the sun or moon's position. Where the sun is directly overhead aBasePart, the shift in color will only apply to the top surface.This effect can be increased or reduced by altering
Brightness.Note that
ColorShift_TopandColorShift_Bottomwill interact with theAmbientandOutdoorAmbientproperties if they are greater than[0, 0, 0].EnvironmentDiffuseScale
: floatAmbient light that is derived from the environment.Ambient light that is derived from the environment with a default of
0. This property is similar toAmbientandOutdoorAmbientbut it's dynamic and can change according to the sky and time of day. When this property is increased, it's recommended to decreaseAmbientandOutdoorAmbientaccordingly.EnvironmentSpecularScale
: floatSpecular light derived from environment.Specular light derived from environment with a default of
0. This property will make smooth objects reflect the environment and it is especially important to make metal look more realistic.ExposureCompensation
: floatThe exposure compensation value.This property determines the exposure compensation amount which applies a bias to the exposure level of the scene prior to the tonemap step. Defaults to
0(no exposure compensation) and has a range from-5to5. A value of1indicates twice as much exposure and-1means half as much exposure.ExtendLightRangeTo120
: RolloutStateNotScriptableUnused. LightRangeis always clamped to 120 studs.Unused. The maximum
RangeofPointLight,SpotLight, andSurfaceLightobjects is always 120 studs; this property does not change that clamp.This property is typed as
RolloutState. It is non-scriptable and hidden in the Studio Properties window.FogColor
: Color3AColor3value giving the hue ofLightingfog.A
Color3value giving the hue ofLightingfog. Note that fog properties are hidden whenLightingcontains anAtmosphereobject.FogEnd
: floatThe depth from theWorkspace.CurrentCamera, in studs, at which fog will be completely opaque.The depth from the
Workspace.CurrentCamera, in studs, at which fog will be completely opaque. Note that fog properties are hidden whenLightingcontains anAtmosphereobject.FogStart
: floatThe depth from theWorkspace.CurrentCamera, in studs, at which fog begins to show.The depth from the
Workspace.CurrentCamera, in studs, at which fog begins to show. Note that fog properties are hidden whenLightingcontains anAtmosphereobject.GeographicLatitude
: floatThe geographic latitude, in degrees, of the scene, influencing the result ofLightingtime on the position of the sun and moon.The geographic latitude, in degrees, of the scene, influencing the result of
Lightingtime on the position of the sun and moon. When calculating the position of the sun, the earth's tilt is also taken into account.Changing
GeographicLatitudewill alter the position of the sun at everyTimeOfDay. If you're looking to obtain the sun or moon's position, useGetSunDirection()orGetMoonDirection().GlobalShadows
: booleanToggles voxel-based dynamic lighting for the place.Toggles voxel-based dynamic lighting in the place. When set to
true, shadows are rendered in sheltered areas depending on the position of the sun and moon. The lighting hue applied to these sheltered areas is determined by theAmbientproperty while the lighting hue in all other areas is determined by theOutdoorAmbientproperty.When
false, shadows are not drawn and no distinction is made between indoor and outdoor areas. As a result, theAmbientproperty determines the lighting hue andOutdoorAmbientwill do nothing.Shadows are calculated using a voxel system and each lighting voxel is 4×4×4 studs. This means objects need to be larger than 4×4×4 studs to display a realistic shadow. Shadows are also recalculated when
BasePartsare moving.LightingStyle
: LightingStyleThe artistic intent behind lighting in the experience.LightingStyleindicates the artistic intent behind lighting in the experience, as anLightingStyleoption.LightingStyle.Softis the stylized look;LightingStyle.Realisticis the naturalistic look. The actual shadowing path also depends onPrioritizeLightingQuality(for example, Soft with that property enabled uses shadow maps rather than voxel lighting).OutdoorAmbient
: Color3The lighting hue applied to outdoor areas.OutdoorAmbientis the lighting hue applied to outdoor areas.OutdoorAmbientdefaults to[127, 127, 127]. As long as the red, green, and blue channels ofAmbientdo not exceed the corresponding channels inOutdoorAmbient, the hue of the lighting in outdoor areas will be determined by this property.The effective
OutdoorAmbientvalue is clamped to be greater than or equal toAmbientin all channels, meaning that if a channel ofAmbientexceeds its correspondingOutdoorAmbientchannel, the hue ofAmbientwill begin to apply to outdoor areas.Note that when
GlobalShadowsis disabled, there is no distinction between areas occluded from the sky and non‑occluded areas. In this case,OutdoorAmbientwill be ignored and the hue from theAmbientproperty will be applied everywhere.PrioritizeLightingQuality
: booleanIndicates whether you prefer lighting/shading quality or view distance to scale down first.This property indicates whether you prefer lighting/shading quality or view distance to scale down first. As the rendering quality level reduces, a setting of
trueprioritizes features such as advanced shadows and high‑quality shaders at closer distances, while a setting offalseprioritizes view distance.ShadowSoftness
: floatControls how blurry the shadows are.Controls how blurry the shadows are with a default of
0.2. This property only works whenTechnologymode isShadowMaporFutureand the device is capable of rendering shadow maps.TimeOfDay
: stringA 24-hour string representation of the current time of day used byLighting.A 24-hour string representation of the current time of day used by
Lighting. For example:local Lighting = game:GetService("Lighting") Lighting.TimeOfDay = "11:00" -- Set time of day to 11:00 AM Lighting.TimeOfDay = "21:30" -- Set time of day to 9:30 PMNote that this property does not correspond with the real-world time of day and will not change during gameplay unless it has been changed by a script.
For a numeric measure of
Lightingtime, useClockTime. ChangingClockTimeor usingSetMinutesAfterMidnight()will also change this property.
Methods 4
GetMinutesAfterMidnight
() → doubleReturns the number of minutes that have passed after midnight for the purposes of lighting.Returns the number of minutes that have passed after midnight for the purposes of lighting. This number will be nearly identical to
ClockTimemultiplied by60.Note that this number will not always be equal to the value given in
SetMinutesAfterMidnight()as it returns minutes after midnight in the current day.GetMoonDirection
() → Vector3Returns aVector3representing the direction of the moon.Returns a
Vector3representing the direction of the moon from the position(0, 0, 0). Note that when the moon has "set" and is no longer visible, theVector3returned by this method will continue to point towards the moon below the horizon.GetSunDirection()is a variant of this method for obtaining the direction of the sun.GetSunDirection
() → Vector3Returns aVector3representing the direction of the sun.Returns a
Vector3representing the direction of the sun from the position(0, 0, 0). Note that when the sun has "set" and is no longer visible, theVector3returned by this method will continue to point towards the sun below the horizon.GetMoonDirection()is a variant of this method for obtaining the direction of the moon.SetMinutesAfterMidnight
(minutes: double) → ()SetsTimeOfDayandClockTimeto the given number of minutes after midnight.Sets
TimeOfDayandClockTimeto the given number of minutes after midnight.This method allows a numerical value to be used, for example in a day/night cycle
Script, without the need to convert to a string in the format required byTimeOfDay. It also allows values greater than 24 hours to be given that correspond to times in the next day.The following code sample includes a simple day/night cycle script. The speed of time and the initial time can be changed using the
TIME_SPEEDandSTART_TIMEparameters.
Events 1
LightingChanged
Lighting.LightingChanged:Connect(function(skyChanged))This event fires when aLightingproperty is changed or aSkyis added or removed fromLighting.This event fires when a
Lightingproperty is changed or aSkyis added or removed fromLighting. See theskyChangedparameter for when that flag istrueversusfalse. Some Lighting property changes never fire this event:- Changing
GlobalShadowswill not fire this event. - Changing fog properties
FogColor,FogStart, orFogEndwill not fire this event.
In cases where this behavior is not desired, the
Object.Changedevent orObject.GetPropertyChangedSignalmethod can be used.- Changing
Lighting also has every member of Instance. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.