local function z(z,p,R)local W=Instance.new(z)if p then W.Value=p end W.Changed:connect(R)R(W.Value)return W end local p=z("\067\111\108\111\114\051\086\097\108\117\101",RAIN_DEFAULT_COLOR,function(z)local p=ColorSequence.new(z)Emitter.RainStraight.Color=p Emitter.RainTopDown.Color=p for z,R in pairs(splashAttachments)do R.RainSplash.Color=p end for z,R in pairs(rainAttachments)do R.RainStraight.Color=p R.RainTopDown.Color=p end end)local function R(z)local p=(1-z)*(1-GlobalModifier.Value)local R=1-p straightLowAlpha=RAIN_STRAIGHT_ALPHA_LOW*p+R topdownLowAlpha=RAIN_TOPDOWN_ALPHA_LOW*p+R local W=NumberSequence.new({NSK010;NumberSequenceKeypoint.new(RAIN_TRANSPARENCY_T1,p*RAIN_SPLASH_ALPHA_LOW+R,0),NumberSequenceKeypoint.new(RAIN_TRANSPARENCY_T2,p*RAIN_SPLASH_ALPHA_LOW+R,0),NSK110})for z,p in pairs(splashAttachments)do p.RainSplash.Transparency=W end end local W=z("\078\117\109\098\101\114\086\097\108\117\101",RAIN_DEFAULT_TRANSPARENCY,R)GlobalModifier.Changed:connect(R)local s=z("\078\117\109\098\101\114\086\097\108\117\101",RAIN_DEFAULT_SPEEDRATIO,function(z)Emitter.RainStraight.Speed=NumberRange.new(z*RAIN_STRAIGHT_MAX_SPEED)Emitter.RainTopDown.Speed=NumberRange.new(z*RAIN_TOPDOWN_MAX_SPEED)end)local k=z("\078\117\109\098\101\114\086\097\108\117\101",RAIN_DEFAULT_INTENSITYRATIO,function(z)Emitter.RainStraight.Rate=RAIN_STRAIGHT_MAX_RATE*z Emitter.RainTopDown.Rate=RAIN_TOPDOWN_MAX_RATE*z intensityOccludedRain=math.ceil(RAIN_OCCLUDED_MAXINTENSITY*z)numSplashes=RAIN_SPLASH_NUM*z end)local m=z("\078\117\109\098\101\114\086\097\108\117\101",RAIN_DEFAULT_LIGHTEMISSION,function(z)Emitter.RainStraight.LightEmission=z Emitter.RainTopDown.LightEmission=z for p,R in pairs(rainAttachments)do R.RainStraight.LightEmission=z R.RainTopDown.LightEmission=z end for p,R in pairs(splashAttachments)do R.RainSplash.LightEmission=z end end)local V=z("\078\117\109\098\101\114\086\097\108\117\101",RAIN_DEFAULT_LIGHTINFLUENCE,function(z)Emitter.RainStraight.LightInfluence=z Emitter.RainTopDown.LightInfluence=z for p,R in pairs(rainAttachments)do R.RainStraight.LightInfluence=z R.RainTopDown.LightInfluence=z end for p,R in pairs(splashAttachments)do R.RainSplash.LightInfluence=z end end)local Q=z("\086\101\099\116\111\114\051\086\097\108\117\101",RAIN_DEFAULT_DIRECTION,function(z)if z.magnitude>.001 then rainDirection=z.unit end end)
-- Shorthand for creating a tweenable "variable" using value object
local function makeProperty(valueObjectClass, defaultValue, setter)
	local valueObject = Instance.new(valueObjectClass)
	if defaultValue then
		valueObject.Value = defaultValue
	end
	valueObject.Changed:connect(setter)
	setter(valueObject.Value)
	return valueObject
end

local Color = makeProperty("Color3Value", RAIN_DEFAULT_COLOR, function(value)
	local value = ColorSequence.new(value)

	Emitter.RainStraight.Color = value
	Emitter.RainTopDown.Color = value

	for _, v in pairs(splashAttachments) do
		v.RainSplash.Color = value
	end
	for _, v in pairs(rainAttachments) do
		v.RainStraight.Color = value
		v.RainTopDown.Color = value
	end
end)

local function updateTransparency(value)
	local opacity = (1 - value) * (1 - GlobalModifier.Value)
	local transparency = 1 - opacity

	straightLowAlpha = RAIN_STRAIGHT_ALPHA_LOW * opacity + transparency
	topdownLowAlpha = RAIN_TOPDOWN_ALPHA_LOW * opacity + transparency

	local splashSequence = NumberSequence.new({
		NSK010,
		NumberSequenceKeypoint.new(RAIN_TRANSPARENCY_T1, opacity * RAIN_SPLASH_ALPHA_LOW + transparency, 0),
		NumberSequenceKeypoint.new(RAIN_TRANSPARENCY_T2, opacity * RAIN_SPLASH_ALPHA_LOW + transparency, 0),
		NSK110,
	})

	for _, v in pairs(splashAttachments) do
		v.RainSplash.Transparency = splashSequence
	end
end
local Transparency = makeProperty("NumberValue", RAIN_DEFAULT_TRANSPARENCY, updateTransparency)
GlobalModifier.Changed:connect(updateTransparency)

local SpeedRatio = makeProperty("NumberValue", RAIN_DEFAULT_SPEEDRATIO, function(value)
	Emitter.RainStraight.Speed = NumberRange.new(value * RAIN_STRAIGHT_MAX_SPEED)
	Emitter.RainTopDown.Speed = NumberRange.new(value * RAIN_TOPDOWN_MAX_SPEED)
end)

local IntensityRatio = makeProperty("NumberValue", RAIN_DEFAULT_INTENSITYRATIO, function(value)
	Emitter.RainStraight.Rate = RAIN_STRAIGHT_MAX_RATE * value
	Emitter.RainTopDown.Rate = RAIN_TOPDOWN_MAX_RATE * value

	intensityOccludedRain = math.ceil(RAIN_OCCLUDED_MAXINTENSITY * value)
	numSplashes = RAIN_SPLASH_NUM * value
end)

local LightEmission = makeProperty("NumberValue", RAIN_DEFAULT_LIGHTEMISSION, function(value)
	Emitter.RainStraight.LightEmission = value
	Emitter.RainTopDown.LightEmission = value

	for _, v in pairs(rainAttachments) do
		v.RainStraight.LightEmission = value
		v.RainTopDown.LightEmission = value
	end
	for _, v in pairs(splashAttachments) do
		v.RainSplash.LightEmission = value
	end
end)

local LightInfluence = makeProperty("NumberValue", RAIN_DEFAULT_LIGHTINFLUENCE, function(value)
	Emitter.RainStraight.LightInfluence = value
	Emitter.RainTopDown.LightInfluence = value

	for _, v in pairs(rainAttachments) do
		v.RainStraight.LightInfluence = value
		v.RainTopDown.LightInfluence = value
	end
	for _, v in pairs(splashAttachments) do
		v.RainSplash.LightInfluence = value
	end
end)

local RainDirection = makeProperty("Vector3Value", RAIN_DEFAULT_DIRECTION, function(value)
	if value.magnitude > 0.001 then
		rainDirection = value.unit
	end
end)
