{"id":655,"date":"2025-03-05T07:42:02","date_gmt":"2025-03-05T12:42:02","guid":{"rendered":"https:\/\/kushaltimsina.com\/blog\/?p=655"},"modified":"2025-03-05T07:42:03","modified_gmt":"2025-03-05T12:42:03","slug":"how-to-script-a-day-and-night-cycle-in-roblox","status":"publish","type":"post","link":"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/","title":{"rendered":"How to Script a Day and Night Cycle in Roblox"},"content":{"rendered":"\n<figure class=\"wp-block-video\"><video controls muted src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/2025-03-05-07-28-56.mov\"><\/video><figcaption class=\"wp-element-caption\">The completed Day\/Night cycle by the end of this article<\/figcaption><\/figure>\n\n\n\n<p>Day\/Night Cycles are a feature in Roblox games, where the sky gets darker as the time passes, and brighter as morning starts. In this article, I&#8217;ll teach you how to script your very own awesome day and night cycle for your Roblox game.<\/p>\n\n\n\n<p>To begin with, you&#8217;ll want to <a href=\"https:\/\/kushaltimsina.com\/blog\/2025\/02\/05\/how-to-download-roblox-studio\/\">download Roblox Studio<\/a> and make sure that you can see the <a href=\"https:\/\/kushaltimsina.com\/blog\/2025\/02\/28\/what-is-the-explorer-window-in-roblox-studio\/\">Explorer<\/a> and <a href=\"https:\/\/kushaltimsina.com\/blog\/2025\/03\/03\/what-is-the-properties-window-in-roblox-studio\/\">Properties<\/a> windows.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How Time Works in Roblox<\/strong><\/h2>\n\n\n\n<p>In order to script a day and night cycle on Roblox, we have to first understand how time is handled in Roblox. So, let&#8217;s start there.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Lighting<\/strong><\/h3>\n\n\n\n<p>Inside of your Explorer window, look for the Lighting service.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"292\" height=\"1024\" src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-13-292x1024.png\" alt=\"The Lighting service in the Explorer\" class=\"wp-image-661\" style=\"width:200px\" srcset=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-13-292x1024.png 292w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-13-438x1536.png 438w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-13.png 496w\" sizes=\"auto, (max-width: 292px) 100vw, 292px\" \/><figcaption class=\"wp-element-caption\">The Lighting Service on Roblox is represented by a lightbulb, and is located right below Players.<\/figcaption><\/figure>\n\n\n\n<p>Lighting is a service on Roblox Studio that handles the lighting in your game. <\/p>\n\n\n\n<p>For example, with Lighting, you can change things like the shadow softness in your game, ambience, brightness, add surrounding fog, etc. <\/p>\n\n\n\n<p>And yes, one of the things you can do with Lighting is change the time of day.<\/p>\n\n\n\n<p>In Roblox, time is handled similarly to how you and I think of time. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The TimeOfDay Property of the Lighting<\/strong><\/h3>\n\n\n\n<p>If you scroll down in the Properties window, you can see that there&#8217;s a property called TimeOfDay.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"520\" height=\"418\" src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-14.png\" alt=\"The TimeOfDay property\" class=\"wp-image-662\" srcset=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-14.png 520w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-14-300x241.png 300w\" sizes=\"auto, (max-width: 520px) 100vw, 520px\" \/><figcaption class=\"wp-element-caption\">The TimeOfDay is in military time.<\/figcaption><\/figure>\n\n\n\n<p>By default, the TimeOfDay is set to 14:30:00.<\/p>\n\n\n\n<p>This might seem confusing to you. I mean, 14 o&#8217;clock!?<\/p>\n\n\n\n<p>Don&#8217;t worry. It&#8217;s written in <a href=\"https:\/\/militarytimechart.com\">military time<\/a>, which means that instead of having AM and PM, it just exceeds the &#8220;12:00&#8221; mark.<\/p>\n\n\n\n<p>So, 14:30:00 in military time is just 2:30 PM.<\/p>\n\n\n\n<p>For you to understand how the TimeOfDay property works in Roblox, it&#8217;d probably help to understand a bit more about military time. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Converting From Military Time to 24 Hour Clock Time<\/strong><\/h3>\n\n\n\n<p>So, let me help you convert military time to something you&#8217;re more familiar with (24 Hour Clock Time)<\/p>\n\n\n\n<p>In order to convert from military time to 24 hour clock time, use this rule: <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>If the military time &lt; 12, the clock time is the military time (AM).<\/p>\n\n\n\n<p>If military time >= 12 and military time &lt; 24, the clock time is the military time &#8211; 12 (PM)<\/p>\n\n\n\n<p>If the military time is 24, then the clock time is 12:00 PM.<\/p>\n<\/blockquote>\n\n\n\n<p>Confusing? Don&#8217;t worry. I&#8217;ll help you understand. <\/p>\n\n\n\n<p>Let&#8217;s look at a few examples:<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Convert 6:00 to 24 Hour Clock Time <\/strong><\/h4>\n\n\n\n<p>Using the rule above, 6 is less than 12, so 6:00 in military time is the same as 6:00 AM.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Convert 9:00 to 24 Hour Clock Time<\/strong><\/h4>\n\n\n\n<p>Using the rule above, 9 is less than 12, so 9:00 in military time is the same as 9:00 AM.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Convert 14:00 to 24 Hour Clock Time<\/strong><\/h4>\n\n\n\n<p>This one&#8217;s a bit tricky. But we can do it!<\/p>\n\n\n\n<p>14 is larger than 12, but less than 24, so the clock time is is 14 &#8211; 12 = 2:00 PM.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Convert 18:00 to 24 Hour Clock Time<\/strong><\/h4>\n\n\n\n<p>Using the same rule, 18 is in between 12 and 24. <\/p>\n\n\n\n<p>So, we subtract it by 12.<\/p>\n\n\n\n<p>18 &#8211; 12 = 6:00 PM.<\/p>\n\n\n\n<p>Hopefully that made a bit more sense. <\/p>\n\n\n\n<p>If not, <a href=\"https:\/\/militarytimechart.com\">here&#8217;s a chart to help.<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Understanding Time of Day in Roblox<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"599\" src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-15-1024x599.png\" alt=\"Illustrating the Time of Day property to script a Day and Night cycle on Roblox\" class=\"wp-image-664\" srcset=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-15-1024x599.png 1024w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-15-300x175.png 300w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-15-768x449.png 768w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-15.png 1118w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Now, if I told you to set the time to 6 AM, using the rule above, you know that 6 is less than 12, so you can just set the <strong>TimeOfDay<\/strong> to 6:00:00.<\/p>\n\n\n\n<p>And suddenly, it got pretty dark, didn&#8217;t it?<\/p>\n\n\n\n<p>What if you set it to 7 AM? Since 7 is less than 12, you can just set the TimeOfDay to 7:00:00.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"604\" src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-17-1024x604.png\" alt=\"Illustrating the Time of Day property to script a Day and Night cycle on Roblox\" class=\"wp-image-666\" srcset=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-17-1024x604.png 1024w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-17-300x177.png 300w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-17-768x453.png 768w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-17.png 1106w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>It gets brighter!<\/p>\n\n\n\n<p>Pretty cool, huh?<\/p>\n\n\n\n<p>So, just like in real life, we can alter the time of day property, and Roblox changes our scene to match.<\/p>\n\n\n\n<p>From these basic observations, I think you can already tell where this is heading..<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>To make a Day\/Night cycle, we just have to tell Roblox to increase the time every second!<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The ClockTime Property <\/strong><\/h3>\n\n\n\n<p>Now, in case the above observation didn&#8217;t immediately jump out at you, I&#8217;m going to show you something really cool. <\/p>\n\n\n\n<p>So, get excited. This is going to be awesome.<\/p>\n\n\n\n<p>Lighting also has a property called <strong><a href=\"https:\/\/create.roblox.com\/docs\/reference\/engine\/classes\/Lighting#ClockTime\">ClockTime<\/a><\/strong>.<\/p>\n\n\n\n<p>ClockTime works just like the TimeOfDay property, except it&#8217;s a number representing the hour.<\/p>\n\n\n\n<p>So, if we set ClockTime to 6, then it&#8217;s 6:00 AM.<\/p>\n\n\n\n<p>If we set ClockTime to 18, it&#8217;s 6:00 PM.<\/p>\n\n\n\n<p>And you know the best Part?<\/p>\n\n\n\n<p>There&#8217;s a slider!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"484\" height=\"134\" src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-18.png\" alt=\"ClockTime is a property of the Lighting service that changes the time in your Roblox game\" class=\"wp-image-667\" srcset=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-18.png 484w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-18-300x83.png 300w\" sizes=\"auto, (max-width: 484px) 100vw, 484px\" \/><\/figure>\n\n\n\n<p>Go ahead. Let that inner kid out. <\/p>\n\n\n\n<p>Slide the slider and observe the effects of increasing the ClockTime on your game.<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/2025-03-05-07-04-27.mov\"><\/video><figcaption class=\"wp-element-caption\">The effects of changing the ClockTime on the lighting of your game<\/figcaption><\/figure>\n\n\n\n<p>As you can see, as the ClockTime increases, the time in your day also increases.<\/p>\n\n\n\n<p>And now, we have all of the Roblox Studio knowledge we need to begin scripting!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Scripting Your Own Day and Night Cycle<\/strong><\/h2>\n\n\n\n<p>Awesome, so now, I&#8217;ll teach you how to script your very own day and night cycle. <\/p>\n\n\n\n<p>Let&#8217;s get started by creating a script. <\/p>\n\n\n\n<p>Add a Script into ServerScriptService.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"543\" src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-19-1024x543.png\" alt=\"\" class=\"wp-image-671\" srcset=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-19-1024x543.png 1024w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-19-300x159.png 300w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-19-768x407.png 768w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-19-1536x814.png 1536w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-19-2048x1085.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">A Script has been added into ServerScriptService<\/figcaption><\/figure>\n\n\n\n<p>Now, if scripting is confusing to you, don&#8217;t worry. I&#8217;ve been <a href=\"http:\/\/kushaltimsina.com\/experience\">teaching it for the past 9 years<\/a>, so I&#8217;ll explain everything in a way where you can understand.<\/p>\n\n\n\n<p>Remember the big idea from earlier?<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>To make a Day\/Night cycle, we just have to tell Roblox to increase the time every second!<\/p>\n<\/blockquote>\n\n\n\n<p>That&#8217;s exactly what we&#8217;re going to do.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>While Loops<\/strong><\/h3>\n\n\n\n<p>We need to tell Roblox &#8220;I want you to do something every second&#8221;<\/p>\n\n\n\n<p>To do this, we can use something called a <strong>while loop<\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:lua decode:true \" title=\"A while true loop tells Roblox to do something every 1 second\" >while task.wait(1) do\n\nend<\/pre><\/div>\n\n\n\n<p>This is a while loop that tells Roblox to do something every 1 second.<\/p>\n\n\n\n<p>The <code>task.wait(1)<\/code> means &#8220;1 second&#8221;<\/p>\n\n\n\n<p>The <code>while task.wait(1) do<\/code> means &#8220;Every 1 second, do this&#8221;<\/p>\n\n\n\n<p>Now, what exactly do we want Roblox to do? Spawn 1,000 monkeys? <\/p>\n\n\n\n<p>No, we want Roblox to increase the ClockTime property by 1.<\/p>\n\n\n\n<p>And that&#8217;s exactly what this code will do:<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:lua decode:true \" title=\"A while true loop tells Roblox to do something every 1 second\" >while task.wait(1) do\n  game.Lighting.ClockTime = game.Lighting.ClockTime + 1\nend<\/pre><\/div>\n\n\n\n<p>Once you&#8217;ve put that above code in your script, you can click play, and marvel as you have a working day and night cycle!<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/2025-03-05-07-24-37.mov\"><\/video><figcaption class=\"wp-element-caption\">Our Day and Night cycle<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Improving the Day and Night Cycle<\/strong><\/h3>\n\n\n\n<p>Cool!<\/p>\n\n\n\n<p>Now, we can actually make this day and night cycle even better by <a href=\"https:\/\/kushaltimsina.com\/blog\/2025\/01\/08\/beginners-guide-to-linear-interpolation\/\">using a technique called linear interpolation to our advantage<\/a>.<\/p>\n\n\n\n<p>Basically, what we&#8217;re going to do is instead of increasing the time by 1 hour every second, we&#8217;re going to increase the time by 1\/10 of an hour every 0.1 seconds.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:lua decode:true \" title=\"A while true loop tells Roblox to do something every 1 second\" >while task.wait(0.1) do\n  game.Lighting.ClockTime = game.Lighting.ClockTime + 0.1\nend<\/pre><\/div>\n\n\n\n<p>This is going to make our Day and Night cycle 10x smoother, because now, instead of it suddenly passing an hour in our game every second, it&#8217;ll pass by 1\/10 of an hour every 1\/10 of a second.<\/p>\n\n\n\n<p>That&#8217;s about 6 minutes every 0.1 second. <\/p>\n\n\n\n<p>And our Day and Night cycle will be even smoother.<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/2025-03-05-07-28-56.mov\"><\/video><figcaption class=\"wp-element-caption\">A smoother version of the day and night cycle, using a technique called linear interpolation<\/figcaption><\/figure>\n\n\n\n<p>Theoretically, we could make our original Day and Night cycle 100x smoother by changing the time by 1% of an hour every <code>0.01<\/code> second.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:lua decode:true \" title=\"A while true loop tells Roblox to do something every 1 second\" >while task.wait(0.01) do\n  game.Lighting.ClockTime = game.Lighting.ClockTime + 0.01\nend<\/pre><\/div>\n\n\n\n<p>This will work, and the results will be super smooth!<\/p>\n\n\n\n<p>Except, this smoothing technique can cause issues for our players on low-end devices, because we&#8217;re essentially telling Roblox &#8220;change the time of day extremely often.&#8221;<\/p>\n\n\n\n<p>But there you have it!<\/p>\n\n\n\n<p>If you liked the way I taught you about day and night cycles in this thread, you might be interested in my book, the <a href=\"http:\/\/kushaltimsina.com\/book\">Beginner&#8217;s Guide to Roblox Scripting<\/a>, where you&#8217;ll learn how to script from scratch.<\/p>\n\n\n\n<p>That&#8217;s all I have for today! <\/p>\n\n\n\n<p>Thank you very much for reading, and make sure to subscribe to <strong>Kushal Writes<\/strong>, a free newsletter where you will get awesome Roblox articles like this one delivered to your inbox.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Day\/Night Cycles are a feature in Roblox games, where the sky gets darker as the time passes, and brighter as morning starts. In this article, I&#8217;ll teach you how to script your very own awesome day and night cycle for your Roblox game. To begin with, you&#8217;ll want to download Roblox Studio and make sure [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":664,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[7,14],"class_list":["post-655","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-roblox-scripting-tutorials","tag-game-development","tag-roblox-scripting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Script a Day and Night Cycle in Roblox - Kushal Writes<\/title>\n<meta name=\"description\" content=\"Day and Night cycles make Roblox games appear more lively. In this article, I teach you how to to script your own Day and Night Cycle on Roblox.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Script a Day and Night Cycle in Roblox - Kushal Writes\" \/>\n<meta property=\"og:description\" content=\"Day and Night cycles make Roblox games appear more lively. In this article, I teach you how to to script your own Day and Night Cycle on Roblox.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/\" \/>\n<meta property=\"og:site_name\" content=\"Kushal Writes\" \/>\n<meta property=\"article:published_time\" content=\"2025-03-05T12:42:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-05T12:42:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-15.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1118\" \/>\n\t<meta property=\"og:image:height\" content=\"654\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"kushal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"kushal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/\"},\"author\":{\"name\":\"kushal\",\"@id\":\"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/9ae64ce30587c804d89b1eef21ba5d2f\"},\"headline\":\"How to Script a Day and Night Cycle in Roblox\",\"datePublished\":\"2025-03-05T12:42:02+00:00\",\"dateModified\":\"2025-03-05T12:42:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/\"},\"wordCount\":1267,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/9ae64ce30587c804d89b1eef21ba5d2f\"},\"image\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-15.png\",\"keywords\":[\"game development\",\"roblox scripting\"],\"articleSection\":[\"Roblox Scripting Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/\",\"url\":\"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/\",\"name\":\"How to Script a Day and Night Cycle in Roblox - Kushal Writes\",\"isPartOf\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-15.png\",\"datePublished\":\"2025-03-05T12:42:02+00:00\",\"dateModified\":\"2025-03-05T12:42:03+00:00\",\"description\":\"Day and Night cycles make Roblox games appear more lively. In this article, I teach you how to to script your own Day and Night Cycle on Roblox.\",\"breadcrumb\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/#primaryimage\",\"url\":\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-15.png\",\"contentUrl\":\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-15.png\",\"width\":1118,\"height\":654},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/kushaltimsina.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Script a Day and Night Cycle in Roblox\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/kushaltimsina.com\/blog\/#website\",\"url\":\"https:\/\/kushaltimsina.com\/blog\/\",\"name\":\"Kushal Timsina\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/9ae64ce30587c804d89b1eef21ba5d2f\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/kushaltimsina.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/9ae64ce30587c804d89b1eef21ba5d2f\",\"name\":\"kushal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/11\/tempImage75F1Sw-edited.jpg\",\"contentUrl\":\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/11\/tempImage75F1Sw-edited.jpg\",\"width\":1274,\"height\":849,\"caption\":\"kushal\"},\"logo\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/image\/\"},\"description\":\"Kushal Timsina has been developing Roblox games since 2016, played 40,000,000+ times, teaches Roblox scripting on YouTube to 1,000,000+ views, and is the author of the Beginner's Guide to Roblox Scripting book.\",\"sameAs\":[\"https:\/\/kushaltimsina.com\/blog\"],\"url\":\"https:\/\/kushaltimsina.com\/blog\/author\/kushal\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Script a Day and Night Cycle in Roblox - Kushal Writes","description":"Day and Night cycles make Roblox games appear more lively. In this article, I teach you how to to script your own Day and Night Cycle on Roblox.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/","og_locale":"en_US","og_type":"article","og_title":"How to Script a Day and Night Cycle in Roblox - Kushal Writes","og_description":"Day and Night cycles make Roblox games appear more lively. In this article, I teach you how to to script your own Day and Night Cycle on Roblox.","og_url":"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/","og_site_name":"Kushal Writes","article_published_time":"2025-03-05T12:42:02+00:00","article_modified_time":"2025-03-05T12:42:03+00:00","og_image":[{"width":1118,"height":654,"url":"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-15.png","type":"image\/png"}],"author":"kushal","twitter_card":"summary_large_image","twitter_misc":{"Written by":"kushal","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/#article","isPartOf":{"@id":"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/"},"author":{"name":"kushal","@id":"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/9ae64ce30587c804d89b1eef21ba5d2f"},"headline":"How to Script a Day and Night Cycle in Roblox","datePublished":"2025-03-05T12:42:02+00:00","dateModified":"2025-03-05T12:42:03+00:00","mainEntityOfPage":{"@id":"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/"},"wordCount":1267,"commentCount":0,"publisher":{"@id":"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/9ae64ce30587c804d89b1eef21ba5d2f"},"image":{"@id":"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/#primaryimage"},"thumbnailUrl":"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-15.png","keywords":["game development","roblox scripting"],"articleSection":["Roblox Scripting Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/","url":"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/","name":"How to Script a Day and Night Cycle in Roblox - Kushal Writes","isPartOf":{"@id":"https:\/\/kushaltimsina.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/#primaryimage"},"image":{"@id":"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/#primaryimage"},"thumbnailUrl":"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-15.png","datePublished":"2025-03-05T12:42:02+00:00","dateModified":"2025-03-05T12:42:03+00:00","description":"Day and Night cycles make Roblox games appear more lively. In this article, I teach you how to to script your own Day and Night Cycle on Roblox.","breadcrumb":{"@id":"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/#primaryimage","url":"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-15.png","contentUrl":"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2025\/03\/image-15.png","width":1118,"height":654},{"@type":"BreadcrumbList","@id":"https:\/\/kushaltimsina.com\/blog\/2025\/03\/05\/how-to-script-a-day-and-night-cycle-in-roblox\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kushaltimsina.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Script a Day and Night Cycle in Roblox"}]},{"@type":"WebSite","@id":"https:\/\/kushaltimsina.com\/blog\/#website","url":"https:\/\/kushaltimsina.com\/blog\/","name":"Kushal Timsina","description":"","publisher":{"@id":"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/9ae64ce30587c804d89b1eef21ba5d2f"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kushaltimsina.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/9ae64ce30587c804d89b1eef21ba5d2f","name":"kushal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/11\/tempImage75F1Sw-edited.jpg","contentUrl":"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/11\/tempImage75F1Sw-edited.jpg","width":1274,"height":849,"caption":"kushal"},"logo":{"@id":"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/image\/"},"description":"Kushal Timsina has been developing Roblox games since 2016, played 40,000,000+ times, teaches Roblox scripting on YouTube to 1,000,000+ views, and is the author of the Beginner's Guide to Roblox Scripting book.","sameAs":["https:\/\/kushaltimsina.com\/blog"],"url":"https:\/\/kushaltimsina.com\/blog\/author\/kushal\/"}]}},"_links":{"self":[{"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/posts\/655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/comments?post=655"}],"version-history":[{"count":5,"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/posts\/655\/revisions"}],"predecessor-version":[{"id":676,"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/posts\/655\/revisions\/676"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/media\/664"}],"wp:attachment":[{"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/media?parent=655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/categories?post=655"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/tags?post=655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}