Day & Night Cycle
Overview
A drop-in day/night cycle for any Roblox game. 6 themed presets (Realistic / Fantasy / Horror / Tropical / Arctic / Cyberpunk), four-phase color blending across every Lighting + Atmosphere + ColorCorrection property, auto-replicated time, an optional clock widget with phase-tinted dot, boundary hooks for Dawn / Noon / Dusk / Midnight, and a runtime API for cutscenes and time-of-day game logic.
Set
RealSecondsPerDay and ship. The cycle handles everything else — sun position, sky color, fog, atmosphere, color grading.Open source. Plain Luau. No obfuscation. Edit any file freely.
The Cycle
4-Phase Color Blending
- Dawn — sunrise warmth, soft amber ambient, clearing fog
- Day — peak brightness, blue-shifted sky, low fog
- Dusk — sunset crimson, warm horizon, increasing fog
- Night — deep indigo, cool ambient, dense atmospheric haze
- Smooth interpolation every tick — no popping, no jarring transitions
- 20Hz update rate by default (
UpdateInterval = 0.05) — buttery smooth, costs nothing on a server
6 Themed Presets
- Realistic — earth-like blue sky, golden sun, navy night with star-blue tint (default — fits 90% of games)
- Fantasy — pastel violets, rose horizons, magical cyan-purple haze (RPG · fairy · mystic)
- Horror — permanent overcast gloom, blood-tinted dusk, crushing dark night with thick fog
- Tropical — saturated golden sun, turquoise sky, vivid orange sunsets (beach · island · summer)
- Arctic — pale blue sun, ice-white horizons, aurora-tinted nights (snow · winter biomes)
- Cyberpunk — magenta sun, electric pink dusk, neon-glow night with deep purple haze (sci-fi · synthwave)
- Custom — hand-tune every value via
Config.CustomPhases
What Gets Wired
- Lighting.ClockTime — drives Roblox's built-in sun/moon, replicates to all clients automatically
- Brightness · Ambient · OutdoorAmbient · ColorShift_Top/Bottom — base sky lighting
- FogStart · FogEnd · FogColor — atmospheric depth per phase
- Atmosphere instance — auto-creates if missing, blends Density / Color / Decay / Glare / Haze
- ColorCorrectionEffect — auto-creates if missing, blends Brightness / Contrast / Saturation / TintColor
- Per-layer toggles — disable any layer (
WireFog,WireAtmosphere, etc.) if your game already handles it
The Clock Widget
- 3 display formats —
"24h"(default),"12h"(with AM/PM),"phase"(just "Dawn" / "Day" / "Dusk" / "Night") - Phase-tinted dot — colored dot on the left interpolates through the four phase tints; glanceable mood indicator
- Pure scale sizing — UDim2.fromScale + Min/Max pixel clamps, looks identical on every device
- Mobile auto-position — relocates on phone-only devices to avoid Roblox's jump button area
- Configurable everything — position, anchor, size, font, colors, border, corner radius, transparency
- Disable in one line —
Config.ClockWidget.Show = false - No remotes needed — reads
Lighting.ClockTimedirectly (replicated by Roblox automatically)
Boundary Hooks
Wire game logic to time of day. Each callback fires exactly once per phase crossing.
Hooks.OnDawn(prevHour, newHour)— shopkeepers wake, daytime mobs spawn, vampires retreatHooks.OnNoon(prevHour, newHour)— midday market refresh, lunch buffs, sun magic peakHooks.OnDusk(prevHour, newHour)— light lanterns, spawn nightly mobs, lock daytime shopsHooks.OnMidnight(prevHour, newHour)— daily reset, witching hour bosses, midnight events- Bracket-crossing detection — fires correctly even when
_G.CoreShunDayNight_SetTimeskips a phase - Server-side — fire RemoteEvents from inside the hook for client-side reactions
Runtime API (
_G Hooks)Reading:
_G.CoreShunDayNight_GetTime()— current in-game hour 0..24_G.CoreShunDayNight_GetPhase()— "Dawn" / "Day" / "Dusk" / "Night"_G.CoreShunDayNight_GetSpeed()— current speed multiplier_G.CoreShunDayNight_IsPaused()— boolean
Writing (server-side):
_G.CoreShunDayNight_SetTime(hour)— jump to that hour, fire boundary hooks crossed_G.CoreShunDayNight_SetSpeed(mult)— speed multiplier (1.0 = normal); useful for "time potion" or cutscenes_G.CoreShunDayNight_Pause()— freeze the cycle in place_G.CoreShunDayNight_Resume()— unfreeze the cycle_G.CoreShunDayNight_AdvanceMinutes(n)— jump n in-game minutes forward
Configurable Cycle
- RealSecondsPerDay — 1800 (30 min) is the sweet spot. 600 for arcade-fast. 3600 for realistic. 86400 to map in-game time to real time.
- StartingTime — boot at 06:00 (default), or set to 12:00 for daytime-start, 0:00 for midnight-start
- StartPaused — boot frozen at StartingTime; resume on any trigger you want
- SkipNight — fast-forward through nighttime hours if your game is daytime-only
- UpdateInterval — default 0.05 (20Hz). Bump to 0.1 for very large servers if you want to halve the work.
- DawnHour / NoonHour / DuskHour / MidnightHour — move phase boundaries. Want longer nights? DawnHour=8 + DuskHour=16.
Custom Presets
Adding your own preset takes about 5 lines.
Open
DayNightPresets.lua, append a new entry to Presets with Dawn / Day / Dusk / Night tables (Brightness, Ambient, OutdoorAmbient, ColorShift, Fog, nested Atmosphere, nested ColorCorrection). Then set Theme.Preset = "MyPalette" in DayNightConfig.lua.All numeric fields interpolate linearly. Color3s use
Color3:Lerp. Nested tables interpolate field-by-field.Pairs Well With
- Quest System — time-locked quests via
_G.CoreShunDayNight_GetPhase()in CanAccept predicates; spawn nightly quest mobs inOnDusk - Music Player — swap to a "night" playlist on
OnDusk, back to "day" onOnDawn; massive mood shift for free - Toast — fire
_G.CoreShunToast_Show("Night falls...", "info")insideOnDuskso players notice the shift - Settings Menu — expose a "skip night" toggle that flips
Config.Cycle.SkipNightat runtime
Cross-Platform
- Desktop — clock widget renders top-right by default
- Mobile — clock widget auto-relocates to a touch-safe position on phone-only devices
- Console — same widget, no input needed
- Replicated for free — server writes
Lighting.ClockTime, all clients read it; no RemoteEvents, no drift
What's Included
- CoreShunDayNightCycle.rbxmx — the full system (drop into Workspace + run installer)
- DayNightConfig.lua — single config ModuleScript (the only file you edit)
- DayNightPresets.lua — 6 themed palettes (extensible)
- DayNightServer.lua — cycle loop + phase blending + atmosphere wiring + boundary hooks
- DayNightClient.lua — optional on-screen clock widget
- Installer.lua — one-click command bar installer
- Manual.pdf — comprehensive feature guide
- Cheatsheet.pdf — visual quick-reference
- README.txt — setup + reference
- Rojo project — for active development
Easy Installation
- Drag
CoreShunDayNightCycle.rbxmxinto your place - Open the Studio Command Bar
- Run
require(workspace.CoreShunDayNightCycle.Installer) - Open
DayNightConfigin ReplicatedStorage and pick a preset (or skip — Realistic is default) - Press F5 — the cycle starts at 06:00, completes a full day in 30 minutes. The clock widget appears top-right.
Frequently Asked
How long is one in-game day?
30 real minutes by default. Edit
Config.Cycle.RealSecondsPerDay — 1800 = 30 min, 600 = 10 min, 3600 = 1 hour, 86400 = 24 hours (real-time).My game already has a custom Atmosphere — will it conflict?
Set
Config.Wiring.WireAtmosphere = false. The cycle will leave your Atmosphere alone. Same for Fog (WireFog = false) and ColorCorrection (WireColorCorrection = false).How do I freeze the cycle at sunset for a screenshot?
_G.CoreShunDayNight_SetTime(18); _G.CoreShunDayNight_Pause(). Resume with Resume().How do I make night last longer than day?
Edit
Config.Phases. Default is symmetric (DawnHour=6, DuskHour=18 — 12 hrs each). For 8 hours of day and 16 hours of night, set DawnHour=8 + DuskHour=16. Blending handles non-uniform spacing.Can I add my own preset?
Yes. Open
DayNightPresets.lua and append a new entry with Dawn / Day / Dusk / Night tables. Then set Theme.Preset = "MyPalette". About 5 lines.Does the cycle persist across rejoin?
The cycle is per-server. New servers always start at
StartingTime. If you want game-wide synced time, store the start time in MemoryStoreService and set StartingTime dynamically before requiring the system.How does the clock widget know the time without a remote?
The server writes
Lighting.ClockTime every tick. Roblox replicates Lighting properties to all clients automatically. The client reads Lighting.ClockTime directly — no RemoteEvent, no drift.Will it conflict with other systems that touch Lighting?
Use the wiring flags. If another system handles Fog, set
WireFog = false. The cycle only touches the layers you opt in to.Can I disable the clock widget entirely?
Yes — set
Config.ClockWidget.Show = false. The cycle still runs in the background; you just won't see the on-screen clock.Open source?
Fully. Plain Luau, no obfuscation. Edit any file to customize.
More Tools by coreshun
- In-Game Systems — Quest System, Settings Menu, Music Player (premium), Simple Music Player, Daily Rewards, Loading Screen, Advanced Chat System, Toast, Anti-Exploit, AutoRejoin, Codes Redemption
- Studio Plugins — Color Picker, UI Wireframe, Gamepass Manager, TODO Tracker (free)
- Bundles — up to 45% off
Support
Discord: discord.com/invite/hdB5tadkk8
$3.99 · 6 themed presets · 4-phase blending · Atmosphere + Fog + ColorCorrection · Clock widget · Boundary hooks · Runtime API · Open source
