How do I make a weather system (with actual rain and snow!)

So I have this city game and I want to make a weather system for it. Any ideas on how to do that? What I want in it: rain, snow, ice (if that is possible), wind and actual floods (but not too much though).

You could ofcourse re-create the seasons effect in your game

  • Summer
  • Winter
  • Monsoon

Now you can start with any sequence of seasons like
summer, winter or winter summer

Make a table like this

local temperatures = {
   ["Summer"] = {
     ["High"] = 40, -- celusius
     ["Low"] = 20
   },
    ["Winter"] = {
     ["High"] = 20, -- celusius
     ["Low"] = -10
   },
    ["Monsoon"] = {
     ["High"] = 30, -- celusius
     ["Low"] = 15
   }
}

Now when your current season is summer, you do something like this

local season = "Summer"
local chosentemperature = math.random(temperatures[season]["Low"],temperatures[season]["High"])

Now like this you can do it each day in your game, and then you can make a rainy thingy like this

if chosentemperature <= 0 then -- snow formes when temperature reaches 0 or below
  -- snow function
end

You need to go with base tick as the starting time to change season according to your day time:
Like if your season lasts 3 days in game then:

local startingtime = tick()
local startingseason = seasonstable[math.random(1,3)]
local function gettime()
   return math.round(tick() - startingtime)
end

To fire it:

-- if its been more than 3 mins, since the game begun, change season
if gettime() >= 180 -- 60*3 then
  season = "Winter"
end
3 Likes

Okay I’ll try that once I get the time. Thanks.

1 Like

Since there is a rain and snow function what should I do to create a thunderstorm? (I’m using a gui too)

1 Like

Create a sky in terrain, and make the sky visible only when its thunderstorm, make it look dark like its a thunderstorm

Spawn thunder models into workspace, into random positions, and make it appear for 0.5 seconds, and then make it produce a sound effect to all players, along with a light

2 Likes