Custom lighting and rain system V2
Key RequiredUniversal

Custom lighting and rain system V2

Universal Scriptstyearstyear 754 views 138 executesUpdated Mar 11, 2026
5.0/ 5(2 votes)
20100% Positive
Lua Script•206 lines (5758 chars)
local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")
local Players = game:GetService("Players")
local Lighting = game:GetService("Lighting")
local Camera = Workspace.CurrentCamera
local LocalPlayer = Players.LocalPlayer
local Terrain = Workspace:FindFirstChildOfClass("Terrain") or Instance.new("Terrain",Workspace)

getgenv().GI_SYSTEM = getgenv().GI_SYSTEM or {}
local GI = getgenv().GI_SYSTEM

for _,v in pairs(Lighting:GetChildren()) do
	if v:IsA("Sky") then v:Destroy() end
end

Lighting.Technology = Enum.Technology.Unified
Lighting.Ambient = Color3.fromRGB(65,61,86)
Lighting.Brightness = 3.6
Lighting.EnvironmentDiffuseScale = 0.1
Lighting.EnvironmentSpecularScale = 1
Lighting.GlobalShadows = true
Lighting.OutdoorAmbient = Color3.fromRGB(160,160,160)
Lighting.ShadowSoftness = 0.5
Lighting.GeographicLatitude = 41.733
Lighting.ExposureCompensation = 0.2
Lighting.FogColor = Color3.fromRGB(192,192,192)
Lighting.FogEnd = 100000
Lighting.ClockTime = 6.5

Terrain.WaterColor = Color3.fromRGB(12,81,89)
Terrain.WaterReflectance = 1
Terrain.WaterTransparency = 0.11
Terrain.WaterWaveSize = 0.45
Terrain.WaterWaveSpeed = 25

local sunrays = Instance.new("SunRaysEffect", Lighting)
sunrays.Intensity = 0.03
sunrays.Spread = 0.128

local atmosphere = Instance.new("Atmosphere", Lighting)
atmosphere.Density = 0.3
atmosphere.Decay = Color3.fromRGB(199,174,164)
atmosphere.Color = Color3.fromRGB(125,113,110)
atmosphere.Glare = 0.67
atmosphere.Haze = 0

local dof = Instance.new("DepthOfFieldEffect", Lighting)
dof.FarIntensity = 0.7
dof.FocusDistance = 0.05
dof.InFocusRadius = 50

local clouds = Instance.new("Clouds", Lighting)
clouds.Cover = 0.6
clouds.Density = 0.5
clouds.Color = Color3.fromRGB(225,246,217)

local sky = Instance.new("Sky")
sky.SkyboxBk = "rbxassetid://1618912481"
sky.SkyboxFt = "rbxassetid://1618913244"
sky.SkyboxLf = "rbxassetid://1618912849"
sky.SkyboxRt = "rbxassetid://1618911568"
sky.SkyboxUp = "rbxassetid://1618913654"
sky.SkyboxDn = "rbxassetid://1618913943"
sky.Parent = Lighting

local rainModel = Instance.new("Model")
rainModel.Name = "RainParticles"
rainModel.Parent = Workspace

local drops = Instance.new("Part")
drops.Size = Vector3.new(512,20,512)
drops.Anchored = true
drops.CanCollide = false
drops.Transparency = 1
drops.Parent = rainModel

for i=1,38 do
	local p = Instance.new("ParticleEmitter")
	p.Texture = "rbxassetid://241868005"
	p.Rate = 1e5
	p.Lifetime = NumberRange.new(30)
	p.Speed = NumberRange.new(-100)
	p.Size = NumberSequence.new(3)
	p.Color = ColorSequence.new(Color3.fromRGB(59,124,185), Color3.fromRGB(71,126,177))
	p.LightEmission = 1
	p.LightInfluence = 0
	p.Orientation = Enum.ParticleOrientation.FacingCamera
	p.EmissionDirection = Enum.NormalId.Top
	p.Parent = drops
end

local splashes = Instance.new("Part")
splashes.Size = Vector3.new(512,0.05,512)
splashes.Anchored = true
splashes.CanCollide = false
splashes.Transparency = 1
splashes.Parent = rainModel

for i=1,3 do
	local p = Instance.new("ParticleEmitter")
	p.Texture = "rbxassetid://241576804"
	p.Rate = 1e7
	p.Lifetime = NumberRange.new(0.5)
	p.Speed = NumberRange.new(3)
	p.Size = NumberSequence.new{
		NumberSequenceKeypoint.new(0,0),
		NumberSequenceKeypoint.new(1,1.5)
	}
	p.Transparency = NumberSequence.new{
		NumberSequenceKeypoint.new(0,1),
		NumberSequenceKeypoint.new(0.1,0),
		NumberSequenceKeypoint.new(0.55,0.75),
		NumberSequenceKeypoint.new(1,1)
	}
	p.Acceleration = Vector3.new(0,-30,0)
	p.Orientation = Enum.ParticleOrientation.FacingCamera
	p.Parent = splashes
end

local rainSound = Instance.new("Sound")
rainSound.SoundId = "rbxassetid://3786250088"
rainSound.Looped = true
rainSound.Volume = 1
rainSound.RollOffMaxDistance = 10000
rainSound.RollOffMinDistance = 10
rainSound.Parent = rainModel
rainSound:Play()

local MAX_LIGHTS = 150
local lights = {}

local function isCharacterPart(part)
	local model = part:FindFirstAncestorOfClass("Model")
	return model and Players:GetPlayerFromCharacter(model)
end

local function createBounce(part)
	if not part:IsA("BasePart") then return end
	if isCharacterPart(part) then return end
	if part.Transparency > 0.6 then return end
	if part.Size.Magnitude < 3 then return end
	if #lights >= MAX_LIGHTS then return end
	if part:FindFirstChild("GI_Bounce") then return end

	local att = Instance.new("Attachment")
	att.Name = "GI_Bounce"
	att.Position = Vector3.new(0, part.Size.Y/2, 0)
	att.Parent = part

	local light = Instance.new("PointLight")
	light.Name = "GI_Light"
	light.Range = math.clamp(part.Size.Magnitude*3,25,60)
	light.Brightness = 1.35
	light.Color = part.Color
	light.Shadows = false
	light.Parent = att

	lights[#lights+1] = light
end

local function applyBounce()
	for _,v in ipairs(Workspace:GetDescendants()) do
		createBounce(v)
	end
end

applyBounce()
Workspace.DescendantAdded:Connect(createBounce)

RunService.Heartbeat:Connect(function()
	for i=1,#lights do
		local light = lights[i]
		local part = light.Parent and light.Parent.Parent
		if part and part:IsA("BasePart") and not isCharacterPart(part) then
			light.Color = part.Color
			light.Range = math.clamp(part.Size.Magnitude*3,25,60)
		end
	end
end)

spawn(function()
	while true do
		Terrain.WaterWaveSpeed = 25 + math.sin(tick()*0.5)*15
		Terrain.WaterWaveSize = 0.45 + math.sin(tick()*0.3)*0.2
		task.wait(0.1)
	end
end)

RunService.RenderStepped:Connect(function()
	if Camera then
		local cf = Camera.CFrame
		drops.CFrame = cf + cf.LookVector*10 + Vector3.new(0,5,0)
		splashes.CFrame = cf + cf.LookVector*10 - Vector3.new(0,10,0)
	end

	if Workspace:FindFirstChildOfClass("Terrain") then
		clouds.Parent = Lighting
	else
		clouds.Parent = nil
	end
end)

LocalPlayer.CharacterAdded:Connect(function()
	task.wait(0.5)
	applyBounce()
end)

Features & Information

Custom lighting that makes your gaming experience better and cooler :)
#Exploit#Lighting#StyearX

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts