One prompt mechanic

How to make a day and night cycle in Roblox

A changing sky makes a world feel alive. The plugin moves the clock over time and blends ambient light and atmosphere between day, sunset and night.

The day and night prompt

Select the object in Studio first (or mention it with @), then send this. Change any words you like before sending.

Then keep talking to it

  1. 2Make a full day last 4 minutes.
  2. 3Turn on lamps at night.
  3. 4Make nights darker.

What the AI builds

  • A DayNight Script in ServerScriptService
  • An Atmosphere in Lighting
  • Optional NightLight tagged lamps

How it works

Every frame the script advances Lighting.ClockTime based on the cycle length you choose.

Colors are blended between keyframes (night, sunrise, noon, sunset) so the light never jumps.

Lights tagged NightLight switch on between 6 pm and 6 am.

How to make a day and night cycle in Roblox, step by step

  1. 1

    Send the prompt

    The AI writes a DayNight Script in ServerScriptService and adds an Atmosphere to Lighting if there is none. The default prompt asks for an 8 minute day, which is a common length for Roblox games: long enough that players notice the sunset, short enough that nobody waits long for morning. Change the number in the prompt if you want something else.

  2. 2

    Press Play

    The clock moves forward every frame by the time since the last frame, so it runs at the same speed on every device. With an 8 minute cycle, a full day passes in 8 minutes and every player sees the same time, because the clock runs on the server and Lighting replicates to everyone. When the clock passes midnight it wraps back to zero.

  3. 3

    Watch the sunset

    Ambient light, outdoor ambient and the atmosphere's color and decay are blended between keyframes: dark blue at night, warm orange at sunrise and sunset, neutral at noon. Because the script blends between neighbors instead of switching, there is never a sudden jump in color, even if you set a very short cycle for testing.

  4. 4

    Turn on lamps

    Ask for lamps at night and the AI tags your lights NightLight. Their PointLights turn on before 6 am and after 6 pm, so street lamps, torches and windows come alive at night without a separate script for each.

  5. 5

    Adjust the mood

    Ask for darker nights, a shorter day or a pinker sunset. The keyframes sit in a table at the top of the script.

Roblox day and night settings you can change

Change any of these by asking in plain words, or open the script and edit the value yourself. Each prompt is one undo step, so you can try a value and go back.

CYCLE_SECONDS
Length of a full day, 480 for 8 minutes.
Keyframes
Colors for night, sunrise, noon and sunset in a table at the top of the script.
Atmosphere
Color and decay change with the time of day.
NightLight
Tag for lamps that switch on at night.
Pause
Optional attribute to stop the clock, if you ask for it.

Fixing day and night in Roblox

Time does not move

Check that the script is in ServerScriptService and that no other script sets ClockTime.

Nights are too bright

Ask for darker nights; the night keyframe's ambient colors get darker.

Lamps do not turn on

Lamps need the NightLight tag and a PointLight inside.

Colors jump

Colors are blended between keyframes. If you see jumps, another script may be setting Lighting too.

The cycle is too fast or too slow

The length of a full day is one number, CYCLE_SECONDS, at the top of the script. Say "make a day last 20 minutes" or change the number yourself; the colors still blend the same way.

More day and night ideas to try

Once the basic version works, send one of these as your next prompt. Each builds on what is already in your place.

“Show the time of day in the corner of the screen.”

Adds a ScreenGui that reads Lighting.ClockTime and shows it as hours and minutes.

“Make stars brighter at night.”

Adjusts the sky's star count and the night keyframe so the sky reads clearly.

“Spawn zombies only at night.”

Adds a check in your spawner that runs only when the clock is after 6 pm or before 6 am.

“Make sunsets last longer.”

Moves the sunset keyframes further apart so the orange light holds for more of the cycle.

Where it goes in Explorer

  • ServerScriptService / DayNight (Script) with CYCLE_SECONDS and the color keyframes at the top
  • Lighting / Atmosphere
  • Lamps anywhere in Workspace, tagged NightLight, each with a PointLight

Script names can differ a little; the AI names things to fit your game and tells you what it added.

Tips for a good prompt

Select the object first, or mention it with @, so the AI changes the right thing. Say what the player should see and feel, not how to script it: “the parts should fly a little and spin” works better than naming functions.

Ask for one change at a time and press Play in between. If something is off, describe what you saw, like “it only works once” or “the pieces go through the floor”. If a change goes the wrong way, press Ctrl+Z once and try different words.

Scripting it by hand vs. with AI

A hand-written cycle needs a clock loop, a set of color keyframes, interpolation between them and optional lamp switching. The plugin writes it with all the values in one table at the top, so the look is easy to tune.

Before you start

You need Roblox Studio on Windows or macOS and the free Roblox AI Game Maker plugin, connected to your account with an 8 character code. New accounts get 2 credits and a free model you can use every day. A typical prompt on a cheap model costs a few hundredths of a credit, and the AI play-tests and fixes errors as part of the same build. Write in any language; the AI answers in the same one.

Day and night FAQ

Does every player see the same time?

Yes. The clock runs on the server and replicates to everyone.

Can I pause it?

Ask for a pause attribute and the AI adds a switch you can toggle from other scripts.

Will a day and night cycle cause lag?

No. It changes a few Lighting values each frame on the server, which is very light. The Atmosphere and lights are standard Roblox features.

Can I start the game at sunset?

Yes. Ask for a starting time and the AI sets the clock before the cycle begins.

Related mechanics