local X=Vector3.new(.05,.05,.05)local G=Color3.new(1,1,1)local F=0 local c=1 local T=1 local a=.05 local I=.9 local K=Vector3.new(0,-1,0)local n=.25 local B=.75 local Z=1000 local r=40 local V=100 local g=20 local L="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\053\049\054\055\057\049\054\050\049"local d=.2 local s=1 local u=1 local E="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\056\050\050\056\056\051\048\052\056"local y=.7 local H=NumberSequence.new(10)local z=NumberRange.new(.8)local m=600 local Y=60 local R="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\056\050\050\056\053\054\054\051\051"local Q=.85 local C=NumberSequence.new({NumberSequenceKeypoint.new(0,5.33,2.75),NumberSequenceKeypoint.new(1,5.33,2.75)})local P=NumberRange.new(.8)local e=NumberRange.new(0,360)local w=600 local N=60 local i="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\056\050\050\056\053\054\054\051\051"local W=.6 local D=NumberSequence.new({NumberSequenceKeypoint.new(0,0),NumberSequenceKeypoint.new(.4,3),NumberSequenceKeypoint.new(1,0)})local h=NumberRange.new(.1,.15)local t=NumberRange.new(0,360)local l=20 local o=.5 local M=50 local U=20 local J=100 local O=70 local p=100 local b=Vector2.new(10,10)local v=2 local k=500 local q=-100 local S=100 local f=550 local j=6 local A=35 local x={Vector3.new(.141421363,0,.141421363);Vector3.new(-0.141421363,0,.141421363),Vector3.new(-0.141421363,0,-0.141421363),Vector3.new(.141421363,0,-0.141421363),Vector3.new(.400000006,0,0);Vector3.new(.282842726,0,.282842726);Vector3.new(2.44929371e-17,0,.400000006),Vector3.new(-0.282842726,0,.282842726);Vector3.new(-0.400000006,0,4.89858741e-17);Vector3.new(-0.282842726,0,-0.282842726),Vector3.new(-7.34788045e-17,0,-0.400000006);Vector3.new(.282842726,0,-0.282842726),Vector3.new(.600000024,0,0);Vector3.new(.485410213,0,.352671146),Vector3.new(.185410202,0,.570633948);Vector3.new(-0.185410202,0,.570633948),Vector3.new(-0.485410213,0,.352671146),Vector3.new(-0.600000024,0,7.34788112e-17);Vector3.new(-0.485410213,0,-0.352671146);Vector3.new(-0.185410202,0,-0.570633948);Vector3.new(.185410202,0,-0.570633948);Vector3.new(.485410213,0,-0.352671146);Vector3.new(.772740662,0,.207055241);Vector3.new(.565685451,0,.565685451),Vector3.new(.207055241,0,.772740662);Vector3.new(-0.207055241,0,.772740662);Vector3.new(-0.565685451,0,.565685451);Vector3.new(-0.772740662,0,.207055241),Vector3.new(-0.772740662,0,-0.207055241);Vector3.new(-0.565685451,0,-0.565685451),Vector3.new(-0.207055241,0,-0.772740662);Vector3.new(.207055241,0,-0.772740662);Vector3.new(.565685451,0,-0.565685451),Vector3.new(.772740662,0,-0.207055241)}
-- Options:

local MIN_SIZE = Vector3.new(0.05, 0.05, 0.05) -- Size of main emitter part when rain inactive

local RAIN_DEFAULT_COLOR = Color3.new(1, 1, 1) -- Default color3 of all rain elements
local RAIN_DEFAULT_TRANSPARENCY = 0 -- Default transparency scale ratio of all rain elements
local RAIN_DEFAULT_SPEEDRATIO = 1 -- Default speed scale ratio of falling rain effects
local RAIN_DEFAULT_INTENSITYRATIO = 1 -- Default intensity ratio of all rain elements
local RAIN_DEFAULT_LIGHTEMISSION = 0.05 -- Default LightEmission of all rain elements
local RAIN_DEFAULT_LIGHTINFLUENCE = 0.9 -- Default LightInfluence of all rain elements
local RAIN_DEFAULT_DIRECTION = Vector3.new(0, -1, 0) -- Default direction for rain to fall into

local RAIN_TRANSPARENCY_T1 = 0.25 -- Define the shape (time-wise) of the transparency curves for emitters
local RAIN_TRANSPARENCY_T2 = 0.75

local RAIN_SCANHEIGHT = 1000 -- How many studs to scan up from camera position to determine whether occluded

local RAIN_EMITTER_DIM_DEFAULT = 40 -- Size of emitter block to the side/up
local RAIN_EMITTER_DIM_MAXFORWARD = 100 -- Size of emitter block forwards when looking at the horizon
local RAIN_EMITTER_UP_MODIFIER = 20 -- Maximum vertical displacement of emitter (when looking fully up/down)

local RAIN_SOUND_ASSET = "rbxassetid://1516791621"
local RAIN_SOUND_BASEVOLUME = 0.2 -- Starting volume of rain sound effect when not occluded
local RAIN_SOUND_FADEIN_TIME = 1 -- Tween in/out times for sound volume
local RAIN_SOUND_FADEOUT_TIME = 1

local RAIN_STRAIGHT_ASSET = "rbxassetid://1822883048" -- Some properties of the straight rain particle effect
local RAIN_STRAIGHT_ALPHA_LOW = 0.7 -- Minimum particle transparency for the straight rain emitter
local RAIN_STRAIGHT_SIZE = NumberSequence.new(10)
local RAIN_STRAIGHT_LIFETIME = NumberRange.new(0.8)
local RAIN_STRAIGHT_MAX_RATE = 600 -- Maximum rate for the straight rain emitter
local RAIN_STRAIGHT_MAX_SPEED = 60 -- Maximum speed for the straight rain emitter

local RAIN_TOPDOWN_ASSET = "rbxassetid://1822856633" -- Some properties of the top-down rain particle effect
local RAIN_TOPDOWN_ALPHA_LOW = 0.85 -- Minimum particle transparency for the top-down rain emitter
local RAIN_TOPDOWN_SIZE = NumberSequence.new({
	NumberSequenceKeypoint.new(0, 5.33, 2.75),
	NumberSequenceKeypoint.new(1, 5.33, 2.75),
})
local RAIN_TOPDOWN_LIFETIME = NumberRange.new(0.8)
local RAIN_TOPDOWN_ROTATION = NumberRange.new(0, 360)
local RAIN_TOPDOWN_MAX_RATE = 600 -- Maximum rate for the top-down rain emitter
local RAIN_TOPDOWN_MAX_SPEED = 60 -- Maximum speed for the top-down rain emitter

local RAIN_SPLASH_ASSET = "rbxassetid://1822856633" -- Some properties of the splash particle effect
local RAIN_SPLASH_ALPHA_LOW = 0.6 -- Minimum particle transparency for the splash emitters
local RAIN_SPLASH_SIZE = NumberSequence.new({
	NumberSequenceKeypoint.new(0, 0),
	NumberSequenceKeypoint.new(0.4, 3),
	NumberSequenceKeypoint.new(1, 0),
})
local RAIN_SPLASH_LIFETIME = NumberRange.new(0.1, 0.15)
local RAIN_SPLASH_ROTATION = NumberRange.new(0, 360)
local RAIN_SPLASH_NUM = 20 -- Amount of splashes per frame
local RAIN_SPLASH_CORRECTION_Y = 0.5 -- Offset from impact position for visual reasons
local RAIN_SPLASH_STRAIGHT_OFFSET_Y = 50 -- Offset against rain direction for straight rain particles from splash position
local RAIN_NOSPLASH_STRAIGHT_OFFSET_Y_MIN = 20 -- Min/max vertical offset from camera height for straight rain particles
local RAIN_NOSPLASH_STRAIGHT_OFFSET_Y_MAX = 100 -- when no splash position could be found (i.e. no floor at that XZ-column)

local RAIN_OCCLUDED_MINSPEED = 70 -- Minimum speed for the occluded straight rain emitters
local RAIN_OCCLUDED_MAXSPEED = 100 -- Maximum speed for the occluded straight rain emitters
local RAIN_OCCLUDED_SPREAD = Vector2.new(10, 10) -- Spread angle for the occluded straight rain emitters
local RAIN_OCCLUDED_MAXINTENSITY = 2 -- How many occluded straight rain particles are emitted for every splash for max intensity

local RAIN_OCCLUDECHECK_OFFSET_Y = 500 -- Vertical offset from camera height to start scanning downward from for splashes
local RAIN_OCCLUDECHECK_OFFSET_XZ_MIN = -100 -- Range of possible XZ offset values from camera XZ position for the splashes
local RAIN_OCCLUDECHECK_OFFSET_XZ_MAX = 100
local RAIN_OCCLUDECHECK_SCAN_Y = 550 -- Scan magnitude along rain path

local RAIN_UPDATE_PERIOD = 6 -- Update the transparency of the main emitters + volume of rain inside every X frames

local RAIN_VOLUME_SCAN_RADIUS = 35 -- Defining grid for checking how far the camera is away from a spot exposed to rain
local RAIN_VOLUME_SCAN_GRID = { -- Unit range grid for scanning how far away user is from rain space
	-- range 0.2, 4 pts
	Vector3.new(0.141421363, 0, 0.141421363),
	Vector3.new(-0.141421363, 0, 0.141421363),
	Vector3.new(-0.141421363, 0, -0.141421363),
	Vector3.new(0.141421363, 0, -0.141421363),
	-- range 0.4, 8 pts
	Vector3.new(0.400000006, 0, 0),
	Vector3.new(0.282842726, 0, 0.282842726),
	Vector3.new(2.44929371e-17, 0, 0.400000006),
	Vector3.new(-0.282842726, 0, 0.282842726),
	Vector3.new(-0.400000006, 0, 4.89858741e-17),
	Vector3.new(-0.282842726, 0, -0.282842726),
	Vector3.new(-7.34788045e-17, 0, -0.400000006),
	Vector3.new(0.282842726, 0, -0.282842726),
	-- range 0.6, 10 pts
	Vector3.new(0.600000024, 0, 0),
	Vector3.new(0.485410213, 0, 0.352671146),
	Vector3.new(0.185410202, 0, 0.570633948),
	Vector3.new(-0.185410202, 0, 0.570633948),
	Vector3.new(-0.485410213, 0, 0.352671146),
	Vector3.new(-0.600000024, 0, 7.34788112e-17),
	Vector3.new(-0.485410213, 0, -0.352671146),
	Vector3.new(-0.185410202, 0, -0.570633948),
	Vector3.new(0.185410202, 0, -0.570633948),
	Vector3.new(0.485410213, 0, -0.352671146),
	-- range 0.8, 12 pts
	Vector3.new(0.772740662, 0, 0.207055241),
	Vector3.new(0.565685451, 0, 0.565685451),
	Vector3.new(0.207055241, 0, 0.772740662),
	Vector3.new(-0.207055241, 0, 0.772740662),
	Vector3.new(-0.565685451, 0, 0.565685451),
	Vector3.new(-0.772740662, 0, 0.207055241),
	Vector3.new(-0.772740662, 0, -0.207055241),
	Vector3.new(-0.565685451, 0, -0.565685451),
	Vector3.new(-0.207055241, 0, -0.772740662),
	Vector3.new(0.207055241, 0, -0.772740662),
	Vector3.new(0.565685451, 0, -0.565685451),
	Vector3.new(0.772740662, 0, -0.207055241),
}
