Luz

Tipos

TiposDetalles
PointLightEmite luz en todas las direcciones desde un solo punto.
SpotLightEmite luz en forma de cono, útil para crear haces de luz enfocados.
SurfaceLightEmite luz desde una superficie en una dirección, útil para iluminación de área.

Propiedades

PropiedadesDetalles
BrightnessControla la intensidad de la luz.
ColorEstablece el color de la luz.
RangeDetermina hasta dónde llega la luz.
ShadowsHabilita o deshabilita las sombras proyectadas por la luz.
AngleDefine la dispersión del haz de luz. (SpotLight y SurfaceLight)
FaceEspecifica la dirección desde la cual se emite la luz. (SpotLight y SurfaceLight)
EnabledActiva o desactiva la luz.

Ejemplos de Luz

Usando un 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

Usando un 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

Usando un 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

Si encuentras útil este tutorial y deseas apoyar mi trabajo, considera invitarme a un café.

¡Muchas gracias por tu apoyo!

Invítame a un café