About:
The Moon Cycle is a system that uses a day and night cycle and waits every 3 in-game days to change its moon into the next phase. It starts off as a new moon and then continues its moon cycle from there. It will change its phase at the beginning of each 3 days
How The Script Works
The script works by waiting for the ClockTime
in Lighting to hit 6
, meaning a new day has started. It will then add +1
to a value in ReplicatedStorage called MoonPhase
. Once the MoonPhase hits a certain number it will change the MoonTextureId to its next phase at the beginning of the new day. Once the MoonPhase hits value 21 it will reset back to zero.
Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
if Lighting.ClockTime == 6 then
MoonPhase.Value += 1
if MoonPhase.Value == 0 then --Waxing Crescent
Skybox.MoonTextureId = "http://www.roblox.com/asset/?id=8095157365"
elseif MoonPhase.Value == 3 then --First Quarter
Skybox.MoonTextureId = "http://www.roblox.com/asset/?id=8095158174"
elseif MoonPhase.Value == 6 then --Waxing Gibbous
Skybox.MoonTextureId = "http://www.roblox.com/asset/?id=8095158894"
elseif MoonPhase.Value == 9 then --Full Moon
Skybox.MoonTextureId = "http://www.roblox.com/asset/?id=8095160877"
elseif MoonPhase.Value == 12 then --Waning Gibbous
Skybox.MoonTextureId = "http://www.roblox.com/asset/?id=8095161662"
elseif MoonPhase.Value == 15 then --Third Quarter
Skybox.MoonTextureId = "http://www.roblox.com/asset/?id=8095163367"
elseif MoonPhase.Value == 18 then --Waning Crescent
Skybox.MoonTextureId = "http://www.roblox.com/asset/?id=8095165702"
elseif MoonPhase.Value == 21 then --New Moon
Skybox.MoonTextureId = "http://www.roblox.com/asset/?id=8107271297"
MoonPhase.Value = 0
end
print(MoonPhase.Value)
end
end)
Phases
Moon Cycle:
New Moon:
Waxing Crescent:
First Quarter:
Waxing Gibbous:
Full Moon:
Waning Gibbous:
Third Qaurter:
Waning Crescent:
Future Updates
A lot is planned to be added in the future for the moon cycle such as:
- Celestial Events - Ex: Solar Eclipse, Lunar Moon, Blood Moon, meteor showers
- Moon Gui - shows what phase the moon is on, what time of the day it is, and what the weather is like.
- Weather System
If anyone has any suggestions they want to add I will gladly add them in and credit you for the suggestion.
Model Demo:
https://www.roblox.com/library/8108400155/
Game Demo:
roblox.com/games/8108587773/Moon-Cycle-Test