if getgenv().__SA_LightingLock_Running then local existing = getgenv().__SA_LightingLock_Running existing.token = existing.token + 1 local myToken = existing.token if existing.Conn then pcall(function() existing.Conn:Disconnect() end) end if existing.SkyConn then pcall(function() existing.SkyConn:Disconnect() end) end existing.Conn = nil existing.SkyConn = nil getgenv().__SA_LightingLock_Running = nil local ok, StarterGui = pcall(game.GetService, game, "StarterGui") if ok then pcall(function() StarterGui:SetCore("SendNotification", { Title = "Lighting Lock", Text = "Unlocked", Duration = 1 }) end) end return end local Lighting = game:GetService("Lighting") local RunService = game:GetService("RunService") local StarterGui = game:GetService("StarterGui") local LOCK_PROPS = { "Ambient", "OutdoorAmbient", "Brightness", "ClockTime", "ColorShift_Bottom", "ColorShift_Top", "EnvironmentDiffuseScale", "EnvironmentSpecularScale", "ExposureCompensation", "FogColor", "FogEnd", "FogStart", "GeographicLatitude", "GlobalShadows", "ShadowSoftness", "Technology" } local function notify(text) pcall(function() StarterGui:SetCore("SendNotification", { Title = "Lighting Lock", Text = text, Duration = 1 }) end) end local function snapshot() local snap = {} for _, prop in ipairs(LOCK_PROPS) do local ok, val = pcall(function() return Lighting[prop] end) if ok then snap[prop] = val end end return snap end local function cloneSky() local sky = Lighting:FindFirstChildOfClass("Sky") return sky and sky:Clone() end local state = {token = 1} getgenv().__SA_LightingLock_Running = state local snap = snapshot() local skyClone = cloneSky() state.Conn = RunService.Heartbeat:Connect(function() if getgenv().__SA_LightingLock_Running ~= state then return end for prop, val in pairs(snap) do local ok, cur = pcall(function() return Lighting[prop] end) if ok and cur ~= val then pcall(function() Lighting[prop] = val end) end end end) if skyClone then state.SkyConn = Lighting.ChildAdded:Connect(function(child) if getgenv().__SA_LightingLock_Running ~= state then return end if child:IsA("Sky") and child ~= skyClone then task.defer(function() if getgenv().__SA_LightingLock_Running ~= state then return end pcall(function() child:Destroy() end) if not Lighting:FindFirstChildOfClass("Sky") then local restored = skyClone:Clone() restored.Parent = Lighting end end) end end) if not Lighting:FindFirstChildOfClass("Sky") then skyClone:Clone().Parent = Lighting end end notify("Lighting + skybox locked")