Menu
CoddyTech

Lights Out

Lesson 1 of 20 in Coddy's Roblox Game: Escape the Dark course.

In this course you build an escape game: dark rooms that open one after another, a flashlight, keys and a vault, and a monster that hunts you while you hide, run and look for the way out. It is scary because it is dark, not because of anything gory.

The Lighting service sets the scene. ClockTime is the hour (0 is midnight, so no sun), Ambient is the light in places the sky does not reach, such as indoors, OutdoorAmbient the light outdoors, and fog hides what is far away:

Lighting.ClockTime = 0
Lighting.FogColor = Color3.new(0, 0, 0)
Lighting.FogEnd = 70 -- you see 70 studs, then black

The numbers come from ReplicatedStorage.Settings, so the darkness can be tuned in one place.

challenge icon

Challenge

Easy

Set Lighting.ClockTime to Settings.ClockTime, Ambient and OutdoorAmbient to Settings.Ambient, FogColor to black and FogEnd to Settings.FogEnd. Then print Lights out.

Press Play, then Check.

Try it yourself

-- DarkServer: the Script that runs the game, on the server.
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
local Lighting = game:GetService("Lighting")
local Settings = require(game.ReplicatedStorage.Settings)

-- Make it night: set Lighting's ClockTime, Ambient, OutdoorAmbient,
-- FogColor (black) and FogEnd from Settings. Then print "Lights out".
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Roblox Game: Escape the Dark