Light

Types

TypesDetails
PointLightEmits light in all directions from a single point.
SpotLightEmits light in a cone shape, useful for creating focused beams.
SurfaceLightEmits light from a surface in one direction, useful for area lighting.

Properties

PropertiesDetails
BrightnessControls the intensity of the light.
ColorSets the color of the light.
RangeDetermines how far the light reaches.
ShadowsEnables or disables shadows cast by the light.
AngleDefines the spread of the light beam. (SpotLight and SurfaceLight)
FaceSpecifies the direction the light is emitted from. (SpotLight and SurfaceLight)
EnabledToggles the light on or off.

Light Examples

Using a PointLight

local part = script.Parent 

local pointLight = Instance.new("PointLight")
pointLight.Parent = part

pointLight.Brightness = 2 -- Controls the intensity of the light
pointLight.Color = Color3.fromRGB(255, 255, 255) -- White light
pointLight.Range = 16 -- How far the light reaches
pointLight.Shadows = true -- Enable shadows
pointLight.Enabled = true -- Ensure the light is turned on

-- Function to toggle the light on and off every 1 second
while true do
	pointLight.Enabled = not pointLight.Enabled -- Toggle the light's enabled state
	wait(1) -- Wait for 1 second before toggling again
end
Image 1
Roblox Studio

Using a SpotLight

local part = script.Parent 

local spotLight = Instance.new("SpotLight")
spotLight.Parent = part

spotLight.Brightness = 8 -- Controls the intensity of the light
spotLight.Color = Color3.fromRGB(255, 255, 255) -- White light
spotLight.Range = 16 -- How far the light reaches
spotLight.Shadows = true -- Enable shadows
spotLight.Angle = 90 -- Width of the cone (in degrees)
spotLight.Face = Enum.NormalId.Front -- Direction the light is facing
spotLight.Enabled = true -- Ensure the light is turned on

-- Function to toggle the light on and off every 1 second
while true do
    spotLight.Enabled = not spotLight.Enabled -- Toggle the light's enabled state
    wait(1) -- Wait for 1 second before toggling again
end
Image 1
Image 2
Roblox Studio

Using a SurfaceLight

local part = script.Parent 

local pointLight = Instance.new("PointLight")
pointLight.Parent = part

pointLight.Brightness = 2 -- Controls the intensity of the light
pointLight.Color = Color3.fromRGB(255, 255, 255) -- White light
pointLight.Range = 16 -- How far the light reaches
pointLight.Shadows = true -- Enable shadows
pointLight.Enabled = true -- Ensure the light is turned on

-- Function to toggle the light on and off every 1 second
while true do
	pointLight.Enabled = not pointLight.Enabled -- Toggle the light's enabled state
	wait(1) -- Wait for 1 second before toggling again
end
Image 1
Roblox Studio

If you found this tutorial helpful and would like to support my work, please consider buying me a coffee.

Thank you very much for your support!

Buy me a coffee