So I wrote a script for weather - Looking for comments suggestions

So a few weeks ago I was brand new to Core Games and this whole game design concept.

I have managed to put together a working design and I'm hoping someone will be able to give tips on how it can be improved. The drop down below holds the script but its formatted wacky. You may want to download from community content to see it.

Script

--QWEATHER SYSTEM v1.1

--AUTHOR: Quailar

-- QWeather System utilizes time and weather to create a dynamic environment.

-- INCLUDED:
-- degrees, hours, minutes, years, am/pm, name for months and days.
-- Sun, Moon, Star, Sky, Lighting settings. eclipse
-- Rain, wind, snow, fog, lightning, heatwave, blizzard, combined weather effects, audio,
-- seasons, fahrenheit, celsius, humidity

-- CUSTOMIZABLE:
-- Degrees per second
-- weather cycles
-- starting day of month
-- starting month of year
-- starting year
-- starting time in degrees
-- farenheit - static variable (debug weather)
-- humidity - static variable (debug weather)

-- OUTPUTS:
-- {hour,min,ampm}
-- hour
-- min
-- year
-- DAYSINWEEK[dow]
-- DAYSINMONTH[moy]
-- season
-- weatherName
-- degrees
-- fahrenheit
-- celsius
-- humidity
-- wind enabled
-- snow enabled
-- heatwave enabled
-- rain enabled
-- lightning enabled
-- fog enabled
-- blizzard enabled
-- clear day enabled
-- clear night enabled
-- eclipse

-- NOTE:
-- This is my first attempt at a script. Its a bit of a mess, but it works.
-- As I learn more I will improve this script. Hope it helps someone
-- Increase weather frequency for more weather changes
-- increase degreespersecond to see more cycles. Pick a number that divides into 360 evenely with no remainder

--
-- Feel free to comment or suggest ways to make this better
-- With your help maybe I will script my first game

-- v1.1 - updated some formulas and eclipse


--Customizable
local DegreesPerSecond = script:GetCustomProperty("DegreesPerSecond") --Game Time speed multiplier - 4 is default
local StartingDay = script:GetCustomProperty("StartingDay") --starting day of the month
local StartingMonth = script:GetCustomProperty("StartingMonth") --staring month of the year
local StartingYear = script:GetCustomProperty("StartingYear") --starting year
local StartingDegree = script:GetCustomProperty("StartingDegree")--starting time in degrees
local WeatherCycles = script:GetCustomProperty("WeatherCycles")--customize how often weather changes divisible evenly into 360
local HumidityTest = script:GetCustomProperty("HumidityTest")--your custom static humidity - zero is default
local FahrenheitTest = script:GetCustomProperty("FahrenheitTest")--your custom static fahrenheit - zero is default

--Get player
local player = Game.GetLocalPlayer();

--Objects
local Sun = script:GetCustomProperty("Sun"):WaitForObject()
local Moon = script:GetCustomProperty("Moon"):WaitForObject()
local Star = script:GetCustomProperty("Star"):WaitForObject()
local SkyDome = script:GetCustomProperty("SkyDome"):WaitForObject()
local SkyLight = script:GetCustomProperty("SkyLight"):WaitForObject()

local DateDisplay = script:GetCustomProperty("DateDisplay"):WaitForObject()
local TimeDisplay = script:GetCustomProperty("TimeDisplay"):WaitForObject()
local SeasonDisplay = script:GetCustomProperty("SeasonDisplay"):WaitForObject()
local HumidityDisplay = script:GetCustomProperty("HumidityDisplay"):WaitForObject()

local Fog = script:GetCustomProperty("Fog"):WaitForObject()
local Rain = script:GetCustomProperty("Rain"):WaitForObject()
local RainSplash = script:GetCustomProperty("RainSplash"):WaitForObject()
local Wind = script:GetCustomProperty("Wind"):WaitForObject()
local Lightning = script:GetCustomProperty("Lightning"):WaitForObject()
local Snow = script:GetCustomProperty("Snow"):WaitForObject()
local Heat = script:GetCustomProperty("Heat"):WaitForObject()
local Glare = script:GetCustomProperty("Glare"):WaitForObject() -- doesnt show with increased light bloom scaling on sun

local WindAudio = script:GetCustomProperty("WindAudio"):WaitForObject()
local RainAudio = script:GetCustomProperty("RainAudio"):WaitForObject()
local SnowAudio = script:GetCustomProperty("SnowAudio"):WaitForObject()
local DayAudio = script:GetCustomProperty("DayAudio"):WaitForObject()
local NightAudio = script:GetCustomProperty("NightAudio"):WaitForObject()
local LightningAudio = script:GetCustomProperty("LightningAudio"):WaitForObject()
local HeatAudio = script:GetCustomProperty("HeatAudio"):WaitForObject()


--VARIABLES

--First Run
local FirstRunSwitch = false--First Run Switch

--Time Variables
local dom = StartingDay
local dow = StartingDay % 7
local moy = StartingMonth
local year = StartingYear
local ampm = ""
local degrees = 0
local sun_time = 0
local moon_time = 0
local star_time = 0
local newDaySwitch = false

--Weather Switches
local fogSwitch = false
local snowSwitch = false
local blizzardSwitch = false
local heatSwitch = false
local rainSwitch = false
local lightningSwitch = false
local windSwitch = false
local tempSwitch = false
local clear_DaySwitch = false
local clear_NightSwitch = false

--Weather Audio Switches
local snow_AudioSwitch = false
local heat_AudioSwitch = false
local rain_AudioSwitch = false
local lightning_AudioSwitch = false
local wind_AudioSwitch = false
local day_AudioSwitch = false
local night_AudioSwitch = false

--Temperature Variables
local season = ""
local fahrenheit = math.random(-20,120) --Current Temperature
local humidity = math.random(20,90) -- Current humidity
local f2 = math.random(-20,120) --Next Temperature
local h2 = math.random(20,90) -- Next humidity

--Weather Settings
local cloudSettings = {0,0,0,0,0,0,0,0,0} --High Cloud brightness, High Cloud Speed, Wisp Speed, High Cloud Opacity, wisp opacity, cloud Opacity, cloud lighting brigthness, sky influence on clouds
local windSettings = {0,0,0,0,-10} --life, density, speedx, speedy, speedz
local rainSettings = {0,0,0,0,0,-10} --emissive boost, life, density, speedx, speedy, speedz
local splashSettings = {0,0,0} --emissive boost, life, density
local lightningSettings = {0,0,0,0} --emissive boost, beams per second, beam width, beam max life
local fogSettings = {0, 0} --density, opacity
local snowSettings = {0,0,0,0} --emissive boost, life, density, size
local heatSettings = {0,0,0,0,0} --brightness shift, clear radius, center areas contrast, blur distance, effect strength

--Sky Settings
local current_HazeColor = {}
local current_HorizonColor = {}
local current_ZenithColor = {}
local next_HazeColor = {}
local next_HorizonColor = {}
local next_ZenithColor = {}

--Haze
local haze_Color = {}
haze_Color[1] = Color.New(36/255, 41/255, 42/255, 1) -- 24292AFF midnight
haze_Color[2] = Color.New(197/255, 64/255, 31/255, 1) -- C5401FFF sunrise
haze_Color[3] = Color.New(176/255, 240/255, 1, 1) -- B0F0FFFF noon
haze_Color[4] = Color.New(197/255, 64/255, 31/255, 1) -- C5401FFF sunset
local haze_Settings = {haze_Color[1], haze_Color[2], haze_Color[3], haze_Color[4]}

--Horizon
local horizon_Color = {}
horizon_Color[1] = Color.New(40/255, 44/255, 58/255, 98/255) -- 282C3A62 midnight
horizon_Color[2] = Color.New(1, 240/255, 130/255, 1) -- FFF082FF sunrise
horizon_Color[3] = Color.New(28/255, 114/255, 191/255, 230/255) -- 1C72BFE6 noon
horizon_Color[4] = Color.New(1, 240/255, 130/255, 1) -- FFF082FF sunset
local horizon_Settings = {horizon_Color[1], horizon_Color[2], horizon_Color[3], horizon_Color[4]}

--Zenith
local zenith_Color = {}
zenith_Color[1] = Color.New(7/255, 7/255, 11/255, 46/255) -- 07070B2E midnight
zenith_Color[2] = Color.New(30/255, 55/255, 126/255, 153/255) -- 1E377E99 sunrise
zenith_Color[3] = Color.New(11/255, 45/255, 143/255, 153/255) -- 0B2D8F99 noon
zenith_Color[4] = Color.New(30/255, 55/255, 126/255, 153/255) -- 1E377E99 sunset
local zenith_Settings = {zenith_Color[1], zenith_Color[2], zenith_Color[3], zenith_Color[4]}

local sunSettings = {0,0} --size, temperature
local phase_time = {.00001, .0001, .001, .01, .1, 1, 10, 100, 1000, 10000} --Used for varying rates of transition speeds

--Days of Week names
local DAYSINWEEK = {
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
}

--Months of year names
local MONTHSINYEAR = {
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
}

--Days in month
local DAYSINMONTH = {
31, --Jan
28, --Feb
31, --Mar
30, --Apr
31, --May
30, --Jun
31, --Jul
31, --Aug
30, --Sep
31, --Oct
31, --Nov
31, --Dec
}


--INPUT DEFAULTS

--zero handling for input
if DegreesPerSecond == 0 then
DegreesPerSecond = 1
end

--zero handling for input
if StartingDay == 0 then
StartingDay = 1
end

--zero handling for input
if StartingMonth == 0 then
StartingMonth = 1
end

--zero handling for input
if StartingYear == 0 then
StartingYear = math.random(2020,5050)
end

--zero handling for input
if 360 % WeatherCycles ~= 0 then
WeatherCycles = 120
end

--zero handling for input
if StartingDegree >= 360 then
StartingDegree = 1
end


--TIME CLOCK

function Tick(deltaTime)
UpdateGameTime()
end

--setup degrees
function UpdateGameTime()

degrees = degrees + (phase_time[4] * DegreesPerSecond)
if (degrees > 360) then
	degrees = degrees - 360
elseif (degrees < 0) then
	degrees = degrees + 360
end

sun_time = degrees + (phase_time[4] * DegreesPerSecond) + 90--sun rotation speed	


moon_time =  moon_time + (phase_time[4] *.97 * DegreesPerSecond)--moon rotation speed	
if (moon_time > 360) then
	moon_time = moon_time - 360
elseif (moon_time < 0) then
	moon_time = moon_time + 360
end	

star_time =  math.abs(star_time + (phase_time[3] * DegreesPerSecond))--star rotation speed	
if (star_time > 360) then
	star_time = star_time - 360
elseif (star_time < 0) then
	star_time = star_time + 360
end	

dome_time = DegreesPerSecond * .5--dome rotation speed

if FirstRunSwitch == false then --First run setup of sky
	FirstRunSwitch = true
	degrees = StartingDegree
	sun_time = degrees + 90--sun location	
	moon_time = degrees + 270--moon location		
	
	--Rotate Sun
	Sun:SetWorldRotation(Rotation.New(0,sun_time,0), 1)
	
	--Rotate Moon
	Moon:SetWorldRotation(Rotation.New(0,moon_time,0), 1)
	
	--Rotate Stars
	Star:SetWorldRotation(Rotation.New(0,star_time,0), .5)
end

---------Hours--------------
local hour = math.floor(degrees / 15) --Find hours from current degrees

--New Day
if CoreMath.Round(hour) == 0 then
	if newDaySwitch == false then
		newDaySwitch = true
		dow = dow + 1
		dom = dom + 1
	end
else 
	newDaySwitch = false
end

--AM/PM	
if hour >= 0 and hour < 12 then
	ampm = "AM"
else
	ampm = "PM"
end

--[[	
--12hour clock
if hour >= 13 then
	hour = hour -12
end
--]]
			
---------Minutes--------------
local min = math.floor((degrees * 4) % 60) --Find minutes from current degrees
	
--Reset days of the week
if dow >= 8 then
	dow = 1
end

---------Resets--------------
--Reset days of month 
if dom > DAYSINMONTH[moy] then
	dom = 1
	moy = moy + 1
end

--Reset months of year
if moy >= 13 then
	moy = 1
	year = year + 1
end

---------Eclipse--------------
local eclipse_distance = math.abs(Sun:GetRotation().y - Moon:GetRotation().y)	--distance between sun and moon in degrees
if eclipse_distance < 5 then
	eclipseSwitch = true
	Moon:SetSmartProperty("Sun Disc Color" ,Color.Lerp(Color.New(.386, .970762, 1, 1),Color.New(.01, .01, .01, 1), 1))
else
	eclipseSwitch = false
	Moon:SetSmartProperty("Sun Disc Color" ,Color.Lerp(Color.New(.386, .970762, 1, 1),Color.New(.01, .01, .01, 1), 0))		
end

--Cycle Settings

--Cycles
local cycle = math.cos(math.rad(degrees))
local cycleWind = math.cos(math.rad(degrees*10)) * 10
local quadrant = math.floor(degrees/90)
local quadPercent = ((degrees - (quadrant*90))/90) % 4
local nextQuadrant = quadrant + 1

--Sky phases

if nextQuadrant == 1 then--midnight
	current_HazeColor = haze_Settings[1]
	current_HorizonColor = horizon_Settings[1]
	current_ZenithColor = zenith_Settings[1]
	next_HazeColor = haze_Settings[2]
	next_HorizonColor = horizon_Settings[2]
	next_ZenithColor = zenith_Settings[2]

elseif nextQuadrant == 2 then--sunrise
	current_HazeColor = haze_Settings[2]
	current_HorizonColor = horizon_Settings[2]
	current_ZenithColor = zenith_Settings[2]
	next_HazeColor = haze_Settings[3]
	next_HorizonColor = horizon_Settings[3]
	next_ZenithColor = zenith_Settings[3]

elseif nextQuadrant == 3 then--noon
	current_HazeColor = haze_Settings[3]
	current_HorizonColor = horizon_Settings[3]
	current_ZenithColor = zenith_Settings[3]
	next_HazeColor = haze_Settings[4]
	next_HorizonColor = horizon_Settings[4]
	next_ZenithColor = zenith_Settings[4]
	
elseif nextQuadrant == 4 then--sunset
	current_HazeColor = haze_Settings[4]
	current_HorizonColor = horizon_Settings[4]
	current_ZenithColor = zenith_Settings[4]
	next_HazeColor = haze_Settings[1]
	next_HorizonColor = horizon_Settings[1]
	next_ZenithColor = zenith_Settings[1]
	
end

--SEASONS/WEATHER

if math.floor(degrees) % WeatherCycles == 0 then --360 % 120 = 3.0 == 3x/day weather updated
	if tempSwitch == false then
		tempSwitch = true
		-------------WINTER----------------
		if moy <= 3 then
			season = "Winter" --set season name
			f2 = math.random(-20,50) -- next fahrenheit
			h2 = math.random(10,80)	 -- next humidity										
		-------------SPRING----------------
		elseif moy <= 6 then
			season = "Spring"	
			f2 = math.random(20,100)
			h2 = math.random(20,95)			
		-------------SUMMER----------------
		elseif moy <= 9 then
			season = "Summer"	
			f2 = math.random(70,120) 
			h2 = math.random(10,90)	
		-------------FALL----------------
		else
			season = "Fall"	
			f2 = math.random(30,80)
			h2 = math.random(30,80)	
		end	
	end
else
	tempSwitch = false
end

--WEATHER TEST VARIABLES-- setting zero in QWeatherSystem will disable
if FahrenheitTest ~= 0 then 
	f2 = FahrenheitTest
end
if HumidityTest ~= 0 then
	h2 = HumidityTest
end

	-------------TEMPERATURE-------------
if fahrenheit < f2 then 									
	fahrenheit = fahrenheit + (phase_time[4] * DegreesPerSecond)	--increase fahrenheit
else
	fahrenheit = fahrenheit - (phase_time[4] * DegreesPerSecond)	--decrease fahrenheit
end

local celsius = CoreMath.Round(((fahrenheit - 32) * 5 / 9), 0) 	--calculate celsius	

	-------------HUMIDITY-------------
if humidity < h2 then 										
	humidity = humidity + (phase_time[4] * .75 * DegreesPerSecond) 		--increase humidity
else
	humidity = humidity - (phase_time[4] * .75 * DegreesPerSecond) 		--decrease humidity
end

local h_f2 = math.abs(math.floor(h2-f2))-- humidity distance ratio	

--CLOUD SETTINGS

if snowSwitch == false and rainSwitch == false and fogSwitch == false then --clear
			
	weatherName = "Clear" -- set weather name	
	
	if cycle < 0 then 
	
		clear_DaySwitch = true
		clear_NightSwitch = false
	
	elseif cycle > 0 then 
	
		clear_DaySwitch = false
		clear_NightSwitch = true
	
	end
	
	--Opacity
	if windSwitch == true then --CLEAR WINDY DAY
	
		cloudSettings[4] = CoreMath.Clamp(cloudSettings[4] + (phase_time[3] * DegreesPerSecond),.01, 1)--High Cloud Opacity												
		cloudSettings[5] = CoreMath.Clamp(cloudSettings[5] - (phase_time[3] * DegreesPerSecond),.01, .5)--Wisp Opacity
		cloudSettings[6] = CoreMath.Clamp(cloudSettings[6] - (phase_time[3] * DegreesPerSecond),.01, .1)--Cloud Opacity (big clouds)	
	
		--HighClouds
		cloudSettings[1] = CoreMath.Clamp(cloudSettings[1] + (phase_time[4] * DegreesPerSecond),.01, 1)--High Cloud brightness
		cloudSettings[7] = CoreMath.Clamp(cloudSettings[7] - (phase_time[4] * DegreesPerSecond),.05, 10)--Cloud Lighting Brightness	
		cloudSettings[8] = CoreMath.Clamp(cloudSettings[8] + (phase_time[3] * DegreesPerSecond),.01, 1)--sky influence on clouds
		cloudSettings[9] = CoreMath.Clamp(cloudSettings[9] + (phase_time[3] * DegreesPerSecond),.01, 1)--cloud ambient brightness
	
	else --CLEAR DAY NO WIND
	
		cloudSettings[4] = CoreMath.Clamp(cloudSettings[4] - (phase_time[3] * DegreesPerSecond),.01, 1)--High Cloud Opacity												
		cloudSettings[5] = CoreMath.Clamp(cloudSettings[5] - (phase_time[3] * DegreesPerSecond),.01, .6)--Wisp Opacity
		cloudSettings[6] = CoreMath.Clamp(cloudSettings[6] - (phase_time[3] * DegreesPerSecond),.01, .5)--Cloud Opacity (big clouds)	
		
		--HighClouds
		cloudSettings[1] = CoreMath.Clamp(cloudSettings[1] + (phase_time[4] * DegreesPerSecond),.01, 1)--High Cloud brightness
		cloudSettings[7] = CoreMath.Clamp(cloudSettings[7] + (phase_time[4] * DegreesPerSecond),.05, 10)--Cloud Lighting Brightness	
		cloudSettings[8] = CoreMath.Clamp(cloudSettings[8] + (phase_time[3] * DegreesPerSecond),.01, 1)--sky influence on clouds
		cloudSettings[9] = CoreMath.Clamp(cloudSettings[9] + (phase_time[3] * DegreesPerSecond),.01, 1)--cloud ambient brightness

	end
	
else

	clear_DaySwitch = false
	clear_NightSwitch = false
	
	if windSwitch == true then -- stormy day with wind
		--opacity
		cloudSettings[4] = CoreMath.Clamp(cloudSettings[4] + (phase_time[3] * DegreesPerSecond),.01, 1)--High Cloud Opacity												
		cloudSettings[5] = CoreMath.Clamp(cloudSettings[5] + (phase_time[3] * DegreesPerSecond),.01, .6)--Wisp Opacity
		cloudSettings[6] = CoreMath.Clamp(cloudSettings[6] + (phase_time[3] * DegreesPerSecond),.01, .1)--Cloud Opacity	
	
		--HighClouds
		cloudSettings[1] = CoreMath.Clamp(cloudSettings[1] - (phase_time[3] * DegreesPerSecond),.01, 1)--High Cloud brightness
		cloudSettings[7] = CoreMath.Clamp(cloudSettings[7] - (phase_time[4] * DegreesPerSecond),.05, 10)--Cloud Lighting Brightness				
		cloudSettings[8] = CoreMath.Clamp(cloudSettings[8] - (phase_time[3] * DegreesPerSecond),.01, 1)--sky influence on clouds
		cloudSettings[9] = CoreMath.Clamp(cloudSettings[9] - (phase_time[3] * DegreesPerSecond),.01, 1)--cloud ambient brightness
		cloudSettings[10] = CoreMath.Clamp((cycle * 1.75),.1,2)--cloud sun behind transmission
	
	else --stormy day no wind
		--opacity
		cloudSettings[4] = CoreMath.Clamp(cloudSettings[4] - (phase_time[3] * DegreesPerSecond),.01, 1)--High Cloud Opacity												
		cloudSettings[5] = CoreMath.Clamp(cloudSettings[5] - (phase_time[3] * DegreesPerSecond),.01, .6)--Wisp Opacity
		cloudSettings[6] = CoreMath.Clamp(cloudSettings[6] + (phase_time[3] * DegreesPerSecond),.01, 1)--Cloud Opacity
		
		--HighClouds
		cloudSettings[1] = CoreMath.Clamp(cloudSettings[1] - (phase_time[3] * DegreesPerSecond),.25, 1)--High Cloud brightness
		cloudSettings[7] = CoreMath.Clamp(cloudSettings[7] - (phase_time[4] * DegreesPerSecond),.25, 10)--Cloud Lighting Brightness				
		cloudSettings[8] = CoreMath.Clamp(cloudSettings[8] - (phase_time[3] * DegreesPerSecond),.25, 1)--sky influence on clouds
		cloudSettings[9] = CoreMath.Clamp(cloudSettings[9] - (phase_time[3] * DegreesPerSecond),.25, 1)--cloud ambient brightness
		
	end	
end			

--Wind

--conditions for wind
if math.floor(h_f2) < -5 and math.ceil(h_f2) > -15 then --If humidity and fahrenheit are within negative 5 and 15 degrees apart
	
	windSwitch = true
	
	weatherName = "Windy" --set weather name
	Wind:Follow(player) --wind follow player
			
	windSettings[1] = CoreMath.Clamp(windSettings[1] + (phase_time[4] * DegreesPerSecond), .1, 10)--life
	windSettings[2] = CoreMath.Clamp(windSettings[2] + (phase_time[5] * DegreesPerSecond), .1, 200)--Density
	windSettings[3] = cycleWind * 10 * 1.75--velosity.x--Windspeed.x
	windSettings[4] = -cycleWind * 10 * 1.75--velosity.x--WindSpeed.y
	cloudSettings[2] = CoreMath.Clamp(cloudSettings[2] + phase_time[1] * .1 * DegreesPerSecond, .1, 1)--High Cloud Speed	- independant of game time multiplier
	cloudSettings[3] = CoreMath.Clamp(cloudSettings[3] + phase_time[1] * .1 * DegreesPerSecond, .1, 1)--Wisp Speed	- independant of game time multiplier
	
else 

	windSwitch = false
			
	windSettings[1] = CoreMath.Clamp(windSettings[1] - (phase_time[4] * DegreesPerSecond), .1, 10)--life
	windSettings[2] = CoreMath.Clamp(windSettings[2] - (phase_time[5] * DegreesPerSecond), .1, 200)--Density
	windSettings[3] = 0--cycleWind * 1.75--velosity.x--Windspeed.x
	windSettings[4] = 0---cycleWind * 1.75--velosity.x--WindSpeed.y
	cloudSettings[2] = CoreMath.Clamp(cloudSettings[2] - phase_time[1] * .1 * DegreesPerSecond, .1, 1)--High Cloud Speed	
	cloudSettings[3] = CoreMath.Clamp(cloudSettings[3] - phase_time[1] * .1 * DegreesPerSecond, .1, 1)--Wisp Speed
	
end

--Rain

--conditions for rain 
if CoreMath.Round(f2,0) > 32 and CoreMath.Round(h2,0) > 60 then--if fahrenheit is over 32 and humidity is over 60% rain is active

	rainSwitch = true	
	
	weatherName = "Raining"--Set weather name
	Rain:Follow(player)
	RainSplash:MoveTo(Vector3.New(player:GetWorldPosition().x,player:GetWorldPosition().y, player:GetWorldPosition().z-100) ,0)--move rain splash to player
			
	rainSettings[1] = CoreMath.Clamp(rainSettings[1] + (phase_time[5] * DegreesPerSecond),.1,50)--emissive boost
	rainSettings[2] = CoreMath.Clamp(rainSettings[2] + (phase_time[4] * DegreesPerSecond),.1,10)--life
	rainSettings[3] = CoreMath.Clamp(rainSettings[3] + (phase_time[4] * DegreesPerSecond),.1,10)--density
	rainSettings[4] = cycleWind--velosity.x
	rainSettings[5] = -cycleWind--velosity.y
	splashSettings[1] = CoreMath.Clamp(splashSettings[1] + (phase_time[4] * DegreesPerSecond),.1,50)--emissive boost
	splashSettings[2] = CoreMath.Clamp(splashSettings[2] + (phase_time[4] * DegreesPerSecond),.1,10)--life
	splashSettings[3] = CoreMath.Clamp(splashSettings[3] + (phase_time[4] * DegreesPerSecond),.1,10)--density
	
else

	rainSwitch = false
			
	rainSettings[1] = CoreMath.Clamp(rainSettings[1] - (phase_time[5] * DegreesPerSecond),.1,50)--emissive boost
	rainSettings[2] = CoreMath.Clamp(rainSettings[2] - (phase_time[4] * DegreesPerSecond),.1,10)--life
	rainSettings[3] = CoreMath.Clamp(rainSettings[3] - (phase_time[4] * DegreesPerSecond),.1,10)--density
	rainSettings[4] = cycleWind--velosity.x
	rainSettings[5] = -cycleWind--velosity.y		
	splashSettings[1] = CoreMath.Clamp(splashSettings[1] - (phase_time[4] * DegreesPerSecond),.1,50)--emissive boost
	splashSettings[2] = CoreMath.Clamp(splashSettings[2] - (phase_time[4] * DegreesPerSecond),.1,10)--life
	splashSettings[3] = CoreMath.Clamp(splashSettings[3] - (phase_time[4] * DegreesPerSecond),.1,10)--density

end

--Lightning

--conditions for lightning
if rainSwitch == true and CoreMath.Round(f2,0) > 80 then --if its raining and fahrenheit is over 80 lightning active

	lightningSwitch = true	
	
	weatherName = "Lightning"
	Lightning:Follow(player)
			
	lightningSettings[1] = CoreMath.Clamp(lightningSettings[1] + (phase_time[4] * DegreesPerSecond), 0, 5)--emissive boost
	lightningSettings[2] = CoreMath.Clamp(lightningSettings[2] + (phase_time[4] * DegreesPerSecond), 0, 1)--beams per second
	lightningSettings[3] = CoreMath.Clamp(lightningSettings[3] + (phase_time[4] * DegreesPerSecond), 0, 10)--beam width
	lightningSettings[4] = CoreMath.Clamp(lightningSettings[4] + (phase_time[4] * DegreesPerSecond), 0, .5)--beam max life
	
else

	lightningSwitch = false
			
	lightningSettings[1] = CoreMath.Clamp(lightningSettings[1] - (phase_time[4] * DegreesPerSecond), 0, 5)--emissive boost
	lightningSettings[2] = CoreMath.Clamp(lightningSettings[2] - (phase_time[4] * DegreesPerSecond), 0, 1)--beams per second
	lightningSettings[3] = CoreMath.Clamp(lightningSettings[3] - (phase_time[4] * DegreesPerSecond), 0, 10)--beam width
	lightningSettings[4] = CoreMath.Clamp(lightningSettings[4] - (phase_time[4] * DegreesPerSecond), 0, .5)--beam max life
	
end	

--Fog

--Conditions for fog
if math.abs(h_f2) <= 5  then --If humidity and fahrenheit are within 5 degrees
	fogSwitch = true
	weatherName = "Foggy" -- set weather name
	
	if cycle > 0 then

		fogSettings[1] = CoreMath.Clamp(fogSettings[1] + (phase_time[3] * DegreesPerSecond),.001, 3) --Density
		fogSettings[2] = CoreMath.Clamp(fogSettings[2] + (phase_time[3] * DegreesPerSecond),.001, .3) --Opacity
	else 

		fogSettings[1] = CoreMath.Clamp(fogSettings[1] + (phase_time[3] * DegreesPerSecond),.001, 9) --Density
		fogSettings[2] = CoreMath.Clamp(fogSettings[2] + (phase_time[3] * DegreesPerSecond),.001, .7) --Opacity
	end
	
elseif h_f2 >= 40 and snowSwitch == true then  --If humidity and fahrenheit are more than 40 degrees apart and snow is falling
	fogSwitch = true	
	weatherName = "Foggy" -- set weather name
	
	if cycle > 0 then

		fogSettings[1] = CoreMath.Clamp(fogSettings[1] + (phase_time[3] * DegreesPerSecond),.001, 3) --Density
		fogSettings[2] = CoreMath.Clamp(fogSettings[2] + (phase_time[3] * DegreesPerSecond),.001, .3) --Opacity
	else 

		fogSettings[1] = CoreMath.Clamp(fogSettings[1] + (phase_time[3] * DegreesPerSecond),.001, 9) --Density
		fogSettings[2] = CoreMath.Clamp(fogSettings[2] + (phase_time[3] * DegreesPerSecond),.001, .7) --Opacity
	end
	
else

	fogSwitch = false
	fogSettings[1] = CoreMath.Clamp(fogSettings[1] - (phase_time[3] * DegreesPerSecond),.001, 9) --Density
	fogSettings[2] = CoreMath.Clamp(fogSettings[2] - (phase_time[3] * DegreesPerSecond),.001, .7) --Opacity
	
end	

--Snow

--conditions for snow
if CoreMath.Round(f2,0) <= 32 and CoreMath.Round(h2,0) > 60 then--if fahrenheit is below 32 and humidity is over 60% snow is active
	
	snowSwitch = true
	
	weatherName = "Snowing" --set weather name
	Snow:Follow(player) --snow follow player
	
	if blizzardSwitch == false then		
		snowSettings[1] = CoreMath.Clamp(snowSettings[1] + (phase_time[5] * DegreesPerSecond),0, 50)--emissive boost
		snowSettings[2] = CoreMath.Clamp(snowSettings[2] + (phase_time[4] * DegreesPerSecond),0, 10)--life
		snowSettings[3] = CoreMath.Clamp(snowSettings[3] + (phase_time[4] * DegreesPerSecond),0, 10)--Density
		snowSettings[4] = CoreMath.Clamp(snowSettings[4] + (phase_time[4] * DegreesPerSecond),0, 10)--size
	end	
else

	snowSwitch = false
	
	snowSettings[1] = CoreMath.Clamp(snowSettings[1] - (phase_time[5] * DegreesPerSecond),0, 50)--emissive boost
	snowSettings[2] = CoreMath.Clamp(snowSettings[2] - (phase_time[4] * DegreesPerSecond),0, 10)--life
	snowSettings[3] = CoreMath.Clamp(snowSettings[3] - (phase_time[4] * DegreesPerSecond),0, 10)--Density
	snowSettings[4] = CoreMath.Clamp(snowSettings[4] - (phase_time[4] * DegreesPerSecond),0, 10)--size		

end

--Blizzard

--conditions for blizzard
if CoreMath.Round(f2,0) <= 0 and CoreMath.Round(h2,0) > 80 then --blizzard
	weatherName = "Blizzard" --set weather name
	blizzardSwitch = true
	
	snowSettings[1] = CoreMath.Clamp(snowSettings[1] + (phase_time[5] * DegreesPerSecond),0, 50)--emissive boost
	snowSettings[2] = CoreMath.Clamp(snowSettings[2] + (phase_time[4] * DegreesPerSecond),0, 20)--life
	snowSettings[3] = CoreMath.Clamp(snowSettings[3] + (phase_time[4] * DegreesPerSecond),0, 20)--Density
	snowSettings[4] = CoreMath.Clamp(snowSettings[4] + (phase_time[4] * DegreesPerSecond),0, 10)--size
else
	blizzardSwitch = false
end -- if conditions for snow are not met blizzard will be decreased along with snow.

--Heat

--conditions for heat
if CoreMath.Round(f2,0) > 90 and CoreMath.Round(h2,0) < 30 then--if fahrenheit is over 90 and humidity is below 30% Heatwave is active
	
	heatSwitch = true
	weatherName = "Heatwave" --set weather name
	Heat:Follow(player) --heat follow player
			
	heatSettings[1] = CoreMath.Clamp(heatSettings[1] + phase_time[3],.01,.2)--Brightness Shift
	heatSettings[2] = CoreMath.Clamp(heatSettings[2] - phase_time[3],.4,.6)--Clear Radius
	heatSettings[3] = CoreMath.Clamp(heatSettings[3] - phase_time[4],4,5)--Center Area Contrast
	heatSettings[4] = CoreMath.Clamp(heatSettings[4] + phase_time[3],0.5,1)--Effect Strength
	Sun:SetSmartProperty("Size", CoreMath.Clamp(-cycle * phase_time[8] * .2, 20, 25))
	
else
		
	heatSettings[1] = CoreMath.Clamp(heatSettings[1] - phase_time[3],.01,.2)--Brightness Shift
	heatSettings[2] = CoreMath.Clamp(heatSettings[2] + phase_time[3],.4,.6)--Clear Radius
	heatSettings[3] = CoreMath.Clamp(heatSettings[3] + phase_time[4],4,5)--Center Area Contrast
	heatSettings[4] = CoreMath.Clamp(heatSettings[4] - phase_time[3],0.5,1)--Effect Strength		
	Sun:SetSmartProperty("Size", CoreMath.Clamp(-cycle * phase_time[8] * .2, 20, 25))
	
end

local CurrentWeather = {windSwitch, rainSwitch, lightningSwitch, fogSwitch, snowSwitch, blizzardSwitch, heatSwitch}
-- considering broacasting the audio


--Audio

--clear day
if clear_DaySwitch == true then

	if day_AudioSwitch == false then
		day_AudioSwitch = true				
		DayAudio:FadeIn(2)
		DayAudio:Follow(player)
	end
else 
	day_AudioSwitch = false	
	DayAudio:FadeOut(2)
end	

--clear night
if clear_NightSwitch == true then

	if night_AudioSwitch == false then
		night_AudioSwitch = true				
		NightAudio:FadeIn(2)
		NightAudio:Follow(player)
	end
else 
	night_AudioSwitch = false	
	NightAudio:FadeOut(2)	
end	

--wind
if windSwitch == true then

	if wind_AudioSwitch == false then
		wind_AudioSwitch = true				
		WindAudio:FadeIn(2)
		WindAudio:Follow(player)
	end
else 
	wind_AudioSwitch = false	
	WindAudio:FadeOut(2)

end	

--rain
if rainSwitch == true then

	if rain_AudioSwitch == false and lightningSwitch == false then
		rain_AudioSwitch = true				
		RainAudio:FadeIn(2)
		RainAudio:Follow(player)
	end
else 
	rain_AudioSwitch = false	
	RainAudio:FadeOut(2)

end	

--lightning
if lightningSwitch == true then

	if lightning_AudioSwitch == false then
		lightning_AudioSwitch = true				
		LightningAudio:FadeIn(2)
		LightningAudio:Follow(player)
	end
else 
	lightning_AudioSwitch = false	
	LightningAudio:FadeOut(2)

end	

--snow
if snowSwitch == true then

	if snow_AudioSwitch == false then
		snow_AudioSwitch = true				
		SnowAudio:FadeIn(2)
		SnowAudio:Follow(player)
	end
else 
	snow_AudioSwitch = false	
	SnowAudio:FadeOut(2)

end	

--heat
if heatSwitch == true then

	if heat_AudioSwitch == false then
		heat_AudioSwitch = true				
		HeatAudio:FadeIn(2)
		HeatAudio:Follow(player)
	end
else 
	heat_AudioSwitch = false	
	HeatAudio:FadeOut(2)

end		

--Sky Settings

SkyDome:SetSmartProperty("Haze Color", Color.Lerp(current_HazeColor, next_HazeColor, quadPercent))
SkyDome:SetSmartProperty("Horizon Color", Color.Lerp(current_HorizonColor, next_HorizonColor, quadPercent))
SkyDome:SetSmartProperty("Zenith Color", Color.Lerp(current_ZenithColor, next_ZenithColor, quadPercent))

SkyDome:SetSmartProperty("Haze Falloff", CoreMath.Clamp(math.abs(cycle * phase_time[7]), 10, 15))
SkyDome:SetSmartProperty("Horizon Falloff", CoreMath.Clamp(math.abs(cycle * phase_time[6]), 4, 6))
SkyDome:SetSmartProperty("Cloud Lighting Brightness", cloudSettings[7])
SkyDome:SetSmartProperty("Brightness", CoreMath.Clamp(-cycle * phase_time[7] *.5, .03, 1.75))

--Cloud settings
SkyDome:SetSmartProperty("Cloud Rim Brightness", CoreMath.Clamp(-cycle * phase_time[7]), 2, 4)
SkyDome:SetSmartProperty("Cloud Sun Behind Transmission", CoreMath.Clamp(-cycle * 1.75),.1,2)--cloud sun behind transmission)
SkyDome:SetSmartProperty("Cloud Ambient Brightness", cloudSettings[9])
SkyDome:SetSmartProperty("Sky Influence On Clouds", cloudSettings[8])

--SkyLight settings
SkyLight:SetSmartProperty("Intensity", CoreMath.Clamp(-cycle * phase_time[7] * 1.75, 1, 3.5))

--HighCloud settings
SkyDome:SetSmartProperty("High Cloud Brightness", cloudSettings[1])
SkyDome:SetSmartProperty("High Cloud Speed", cloudSettings[2])
SkyDome:SetSmartProperty("Cloud Wisp Speed", cloudSettings[3])
SkyDome:SetSmartProperty("High Cloud Opacity", cloudSettings[4])
SkyDome:SetSmartProperty("Cloud Wisp Opacity", cloudSettings[5])
SkyDome:SetSmartProperty("Cloud Opacity", cloudSettings[6])

--Wind Config
Wind:SetSmartProperty("Life", windSettings[1])
Wind:SetSmartProperty("Density", windSettings[2])
Wind:SetSmartProperty("Wind Speed", Vector3.New(windSettings[3],windSettings[4],windSettings[5]))

--Rain Config
Rain:SetSmartProperty("Emissive Boost", rainSettings[1])
Rain:SetSmartProperty("Life", rainSettings[2])
Rain:SetSmartProperty("Density", rainSettings[3])
Rain:SetSmartProperty("Velocity", Vector3.New(rainSettings[4], rainSettings[5], rainSettings[6]))

--RainSplash Config
RainSplash:SetSmartProperty("Emissive Boost", splashSettings[1])
RainSplash:SetSmartProperty("Life", splashSettings[2])
RainSplash:SetSmartProperty("Density", splashSettings[3])

--Lightning Config
Lightning:SetSmartProperty("Beams Per Second", lightningSettings[1])
Lightning:SetSmartProperty("Emissive Boost", lightningSettings[2])
Lightning:SetSmartProperty("Beam Width", lightningSettings[3])
Lightning:SetSmartProperty("Beam Maximum Life", lightningSettings[4])

--Fog Config
Fog:SetSmartProperty("Fog Density", fogSettings[1])
Fog:SetSmartProperty("Opacity", fogSettings[2])

--Snow Config
Snow:SetSmartProperty("Emissive Boost", snowSettings[1])
Snow:SetSmartProperty("Density", snowSettings[2])
Snow:SetSmartProperty("Life", snowSettings[3])
Snow:SetSmartProperty("Size", snowSettings[4])

--Heat Config
Heat:SetSmartProperty("Brightness Shift", heatSettings[1])
Heat:SetSmartProperty("Clear Radius", heatSettings[2])
Heat:SetSmartProperty("Center Area Contrast", heatSettings[3])
Heat:SetSmartProperty("Effect Strength", heatSettings[4])

--Star settings
Star:SetSmartProperty("Star Brightness", CoreMath.Clamp(cycle * (phase_time[7] * .2), 0.05, 2))
Star:SetSmartProperty("Star Color Cycle", CoreMath.Clamp(cycle * phase_time[8], 0, 180))

--Sun settings
Sun:SetSmartProperty("Size", CoreMath.Clamp(-cycle * phase_time[8] * .2, 10, 20))
Sun:SetSmartProperty("Temperature", CoreMath.Clamp(-cycle * phase_time[10] * .65, 2750, 6500))
Sun:SetSmartProperty("Sun Disc Color" ,Color.Lerp(Color.New(5, 4.37, 3.18, 1),Color.New(5, 3.22, .868, 1), math.abs(-cycle)))
Sun:SetSmartProperty("Intensity", CoreMath.Clamp(-cycle * phase_time[7], .5, 5))

--Moon settings
Moon:SetSmartProperty("Size",Sun:GetSmartProperty("Size") * .75 )
Moon:SetSmartProperty("Intensity", CoreMath.Clamp(cycle * phase_time[7] * .3,.5,1))

---------ROTATION----------------
--Rotate Sun
Sun:RotateTo(Rotation.New(0,sun_time,0), 1)
--Rotate Moon
Moon:RotateTo(Rotation.New(0,moon_time,0), 1)
--Rotate Stars
Star:SetWorldRotation(Rotation.New(0,star_time,0), .5)
--Rotate Dome
SkyDome:RotateContinuous(Rotation.New(0,0, dome_time))


--PRINT

--Add leading zero to hour
if math.floor(hour) < 10 then
	hour = "0"..hour
end

--add leading zero to minutes
if math.floor(min) < 10 then
	min = "0"..min
end

print("--------------------------------------")
print("TIME DATA::")
print(hour..":"..min.." "..ampm)
print(MONTHSINYEAR[moy].." "..dom..", "..year)
print("cycle: "..cycle)
print("degrees: "..degrees)
print("quadPercent: "..quadPercent)
print("sun degs: "..Sun:GetRotation().y)
print("moon degs: "..Moon:GetRotation().y)
print("star degs: "..Star:GetRotation().y)
print("startime: "..star_time)
print("--------------------------------------")
print("WEATHER DATA::")
print(CoreMath.Round(fahrenheit,0).."F".."|"..CoreMath.Round(celsius, 0).."C".." "..season.." Humidity: "..CoreMath.Round(humidity,0).."%")
print("Next_temp: "..CoreMath.Round(f2, 0).." Next_humid: "..CoreMath.Round(h2, 0))
print("Current Weather: "..tostring(weatherName))
print("Eclipse: "..tostring(eclipseSwitch))
print("Wind Switch: "..tostring(windSwitch).." Audio: "..tostring(WindAudio.isPlaying))
print("Heat Switch: "..tostring(heatSwitch).." Audio: "..tostring(HeatAudio.isPlaying))
print("Rain Switch: "..tostring(rainSwitch).." Audio: "..tostring(RainAudio.isPlaying))
print("Snow Switch: "..tostring(snowSwitch).." Audio: "..tostring(SnowAudio.isPlaying))
print("Light Switch: "..tostring(lightningSwitch).." Audio: "..tostring(LightningAudio.isPlaying))
print("Fog Switch: "..tostring(fogSwitch).." Density: "..CoreMath.Round(Fog:GetSmartProperty("Fog Density"),0))
print("Day Switch: "..tostring(clear_DaySwitch).." Audio: "..tostring(DayAudio.isPlaying))
print("Night Switch: "..tostring(clear_NightSwitch).." Audio: "..tostring(NightAudio.isPlaying))

--HUD DISPLAY

TimeDisplay.text = DAYSINWEEK[dow].." "..hour..":"..min.." "..ampm
DateDisplay.text = MONTHSINYEAR[moy].." "..dom..", "..year	
SeasonDisplay.text = CoreMath.Round(fahrenheit, 0).."F".." | "..CoreMath.Round(celsius, 0).."C".." "..season
HumidityDisplay.text = CoreMath.Round(humidity, 0).."% H".." | "..tostring(weatherName)

--OUTPUT

_G.gameTime = {hour,min,ampm}
_G.hour = hour
_G.min = min
_G.year = year
_G.day = DAYSINWEEK[dow]
_G.month = DAYSINMONTH[moy]
_G.season = season
_G.weather = weatherName
_G.degrees = degrees
_G.fahrenheit = fahrenheit
_G.celsius = celsius
_G.humidity = humidity
_G.rain = rainSwitch
_G.wind = windSwitch
_G.heat = heatSwitch
_G.snow = snowSwitch
_G.lightning = lightningSwitch
_G.fog = fogSwitch
_G.blizzard = blizzardSwitch
_G.day = daySwitch
_G.night = nightSwitch
_G.eclipse = eclipseSwitch

end

The template is available in the community content.
Search for: QWeather System

Edit: more details