Загрузка данных


ocal Players = game:GetService("Players")
local Lighting = game:GetService("Lighting")
local TweenService = game:GetService("TweenService")

-- Создаем эффект затемнения для экрана (как в Сабнатике)
local colorCorrection = Lighting:FindFirstChild("SubnauticaBlackout") or Instance.new("ColorCorrectionEffect")
colorCorrection.Name = "SubnauticaBlackout"
colorCorrection.Brightness = 0
colorCorrection.Parent = Lighting

local player = Players.LocalPlayer or Players:GetPlayers()[1]

while true do
	task.wait(0.5) -- Проверяем состояние каждые полсекунды
	if player and player.Character then
		local head = player.Character:FindFirstChild("Head")
		
		if head then
			-- Если голова Александра ушла под физическую воду
			if head:GetMaterial() == Enum.Material.Water then
				-- Начинаем плавно делать экран темнее (за 15 секунд в полную темноту)
				TweenService:Create(colorCorrection, TweenInfo.new(15, Enum.EasingStyle.Linear), {Brightness = -1}):Play()
			else
				-- Если вынырнули — экран мгновенно становится светлым и нормальным!
				TweenService:Create(colorCorrection, TweenInfo.new(0.5, Enum.EasingStyle.QuadOut), {Brightness = 0}):Play()
			end
		end
	end
end