Horror games succeed or fail on atmosphere before anything else. The player must feel uneasy before any monster appears — dread built from darkness, fog, ambient sound, and environmental storytelling. When the scare finally comes, it lands harder because of the tension that preceded it. This template is a complete Doors-style horror engine: a client-side atmosphere system with four mood presets (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/brockmartin/roblox-game-skill/llms.txt
Use this file to discover all available pages before exploring further.
Safe, Uneasy, Danger, Panic) and smooth tween transitions, a server-authoritative five-state monster AI finite state machine with pathfinding and line-of-sight detection, a proximity/progress-triggered event sequencer for scripted horror moments, and a jumpscare system that takes camera control, plays a sound stinger, and then executes the kill.
Core Systems
Atmosphere System
Four
Lighting presets with smooth TweenService transitions. Controls ambient brightness, fog density, color correction saturation, and atmosphere haze. Server-driven via AtmosphereRemote.Monster AI (5-State FSM)
Dormant → Patrol → Alert → Chase → Kill. Line-of-sight raycasts, hearing range detection, hiding spot checking, PathfindingService navigation, and configurable speeds per state.Event Sequencer
Parts tagged
HorrorTrigger in the workspace fire sequences of actions (Flicker, DoorSlam, ShadowAppear, SoundPlay, AtmosphereChange) with per-action delays when a player enters.Jumpscare System
Server fires
JumpscareRemote on kill. Client takes camera control, plays a monster-specific sound stinger and screen flash, then yields control back. Kill is applied 1.5 seconds later.Flashlight Controller
Client-side
SpotLight attachment with battery drain, battery pickup interaction, and toggle. Low-battery flicker effect as battery approaches zero.Door & Key System
Locked doors require specific key items in the player’s inventory to open. Keys are placed as world items. Server validates all unlock requests.
Key Code: Atmosphere System
The atmosphere controller defines four presets with fullLighting, ColorCorrectionEffect, and Atmosphere property sets. All transitions use TweenService for smooth mood changes. It also exposes a Flicker utility for rapid panic flashes.
Key Code: Monster AI State Machine
The monster FSM runs at 10 Hz viatask.wait(0.1). Each state (Dormant, Patrol, Alert, Chase, Kill) has an entry handler that sets walk speed and a per-tick update handler. State transitions fire MonsterRemote so clients can react with animations and atmosphere changes.
Key Code: Detection Logic
The monster uses both hearing (range-based) and sight (raycast + field-of-view cone) to detect players. Running players have 1.5× the effective hearing range. Players insideHidingSpot-tagged parts are excluded from detection.
Architecture
- ServerScriptService/HorrorServer
- StarterPlayerScripts/HorrorClient
| Script | Purpose |
|---|---|
MonsterAI.luau | 5-state FSM, pathfinding, sight/hearing detection, hiding spot checks, kill execution |
EventSequencer.luau | Registers HorrorTrigger-tagged parts, fires action sequences on proximity |
DoorKeySystem.luau | Key item inventory, locked door validation, unlock logic |
ProgressionManager.luau | Room/level advancement, difficulty scaling per room number |
GameManager.luau | Round lifecycle, player spawning, win/loss conditions |
Monster FSM Reference
| State | Walk Speed | Entry Condition | Exit Condition |
|---|---|---|---|
Dormant | 0 | Initial state, or activated by EventSequencer | EventSequencer fires activation trigger |
Patrol | PatrolSpeed (default: 10) | After activation, after losing a target | Player detected (sight or hearing) |
Alert | PatrolSpeed × 0.7 | Target lost, investigating last known position | Player re-detected → Chase; Timer expires → Patrol |
Chase | ChaseSpeed (default: 22, > player’s 16) | Player detected | Player hides → search; Player out of sight → Alert; Within kill range → Kill |
Kill | 0 | Within KillRange studs of target | ExecuteKill fires jumpscare; returns to Patrol after 2s delay |
How to Use This Template
See the New Game workflow for the complete 8-step build process.