Heres my code
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Types = require(ReplicatedStorage.Packages.Iris.Types)
local IrisCore = require(ReplicatedStorage.Packages.Iris)
local Packet = require(ReplicatedStorage.Packets.Main)
local UpdateWeather = Packet.UpdateWeather
local climateNames = { [0] = "None", [1] = "Rain", [2] = "Snow", [3] = "Blizzard" }
local skyboxFolder = ReplicatedStorage.Assets.Weather.Skyboxes
local skyboxList = skyboxFolder:GetChildren()
table.sort(skyboxList, function(a,b) return a.Name < b.Name end)
local skyboxNames = {}
for i, sky in ipairs(skyboxList) do
skyboxNames[i] = sky.Name
end
local irisStates = {}
local dirty = {}
local function getOrInitState(key, initial)
if not irisStates[key] then
irisStates[key] = IrisCore.State(initial)
end
return irisStates[key]
end
local function buildUI(Iris, isOpenedState, weatherState)
for k, v in pairs(weatherState) do
if type(v) == "table" and v.R then
getOrInitState(k, Color3.fromRGB(v.R, v.G, v.B))
else
getOrInitState(k, v)
end
end
local window = Iris.Window({ [Iris.Args.Window.Title] = "Weather Debug" }, { isOpened = isOpenedState })
if window.state.isOpened.value then
local function slider(key, label, min, max, inc)
min = min or 0
max = max or 1
inc = inc or 0.01
local st = getOrInitState(key, weatherState[key] or 0)
local res = Iris.SliderNum({ label, inc, min, max }, { number = st })
if res.numberChanged() then
dirty[key] = true
end
end
local function colorInput(key, label)
local raw = weatherState[key] or { R = 255, G = 255, B = 255 }
local st = getOrInitState(key, Color3.fromRGB(raw.R, raw.G, raw.B))
Iris.InputColor3({ label }, { color = st })
end
local function windSlider(sub, label, min, max, inc)
local fullKey = "Wind_" .. sub
local wind = weatherState.Wind or {}
local st = getOrInitState(fullKey, wind[sub] or 0)
local res = Iris.SliderNum({ label, inc or 1, min, max }, { number = st })
if res.numberChanged() then
dirty[fullKey] = true
end
end
Iris.CollapsingHeader({ "Environment" })
local stC = getOrInitState("Climate", weatherState.Climate or 0)
local lbl = climateNames[stC.value] or tostring(stC.value)
local combo = Iris.Combo({ "Climate: " .. lbl }, { index = stC })
for code, name in pairs(climateNames) do
Iris.Selectable({ name, code }, { index = stC })
end
Iris.End()
if combo.closed() then
dirty["Climate"] = true
end
slider("CloudDensity", "Cloud Density", 0, 1, 0.01)
slider("CloudCover", "Cloud Cover", 0, 1, 0.01)
colorInput("CloudColor", "Cloud Color")
slider("FogDensity", "Fog Density", 0, 1, 0.01)
slider("Brightness", "Brightness", 0, 10, 0.1)
windSlider("S", "Wind Speed", 0, 200, 1)
windSlider("Y", "Wind Yaw (deg)", 0, 360, 1)
windSlider("P", "Wind Pitch (deg)", -90, 90, 1)
Iris.End()
Iris.CollapsingHeader({ "Time" })
slider("ClockTime", "Clock Time", 0, 24, 1)
slider("TimeSpeed", "Time Speed", 0, 10, 0.1)
local stTF = getOrInitState("TimeFrozen", weatherState.TimeFrozen)
local cb = Iris.Checkbox({ "Time Frozen" }, { isChecked = stTF })
if cb.checked() or cb.unchecked() then
dirty["TimeFrozen"] = true
end
local stSB = getOrInitState("Skybox", weatherState.Skybox)
local lblSB = skyboxNames[stSB.value] or tostring(stSB.value)
local comboSB = Iris.Combo({ "Skybox: " .. lblSB }, { index = stSB })
for idx, name in ipairs(skyboxNames) do
Iris.Selectable({ name, idx }, { index = stSB })
end
Iris.End()
if comboSB.closed() then
dirty["Skybox"] = true
end
slider("CycleTime", "Cycle Time", 0, 3600, 10)
Iris.End()
Iris.CollapsingHeader({ "Ambient" })
slider("Haze", "Haze", 0, 1)
colorInput("Ambient", "Ambient Color")
colorInput("OutdoorAmbient", "Outdoor Ambient")
Iris.End()
Iris.CollapsingHeader({ "Post-Processing" })
slider("Depth", "Depth", 0, 100, 0.1)
slider("Focus", "Focus", 0, 100, 1)
slider("BlurSize", "Blur Size", 0, 10, 0.1)
slider("SunIntensity", "Sun Intensity", 0, 2, 0.01)
slider("SunSpread", "Sun Spread", 0, 1, 0.01)
slider("BloomIntensity", "Bloom Intensity", 0, 2, 0.01)
slider("ColorCorrectionBrightness", "Color Correction Brightness", -1, 1, 0.01)
slider("Contrast", "Contrast", -1, 1, 0.01)
slider("Saturation", "Saturation", -1, 1, 0.01)
Iris.End()
if Iris.Button({ "Update Weather" }).clicked() then
local changes = {}
for key in pairs(dirty) do
if key:sub(1,5) == "Wind_" then
changes.Wind = changes.Wind or {}
changes.Wind[key:sub(6)] = irisStates[key].value
else
changes[key] = irisStates[key].value
end
end
for _, ck in ipairs({ "CloudColor", "Ambient", "OutdoorAmbient" }) do
local orig = weatherState[ck]
local st = irisStates[ck]
local c3 = st.value
if not (orig
and math.floor(c3.R*255) == orig.R
and math.floor(c3.G*255) == orig.G
and math.floor(c3.B*255) == orig.B
) then
changes[ck] = {
R = math.floor(c3.R*255),
G = math.floor(c3.G*255),
B = math.floor(c3.B*255),
}
end
end
dirty = {}
if next(changes) then
UpdateWeather:Fire(changes)
end
end
end
Iris.End()
return window
end
return {
irisStates = irisStates,
default = buildUI,
}