Hello! For the past hour, I’ve been trying to call a function from a table, but I end up getting an error. Can anyone show me or link me some resources on how I can do this please?
Keep in mind im still pretty new to tables.
Code:
local WeatherManager = workspace.WeatherManager
local WeatherParticles = WeatherManager.WeatherParticles
local WeatherTypes = require(game.ReplicatedStorage.WeatherTypes)
local Weather = {
[1] = WeatherTypes.Sunny(),
[2] = WeatherTypes.Foggy(),
[3] = WeatherTypes.PartlyCloudy(),
[4] = WeatherTypes.Rainy(),
[5] = WeatherTypes.Cloudy(),
[6] = WeatherTypes.Nighttime()
}
while true do
local tab = Weather[math.random(1, #Weather)] -- this errors sadly
-- how run a random function from the Weather table???
wait(5)
end