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


local Lighting = game:GetService("Lighting")

-- Save original fog settings so we can restore them
local defaultFog = {
	FogStart = Lighting.FogStart,
	FogEnd = Lighting.FogEnd,
	FogColor = Lighting.FogColor
}

local fogEnabled = false
local fogColor = Color3.fromRGB(255, 90, 170) -- default pink

local function parseHexColor(str)
	str = tostring(str or ""):gsub("%s+", ""):gsub("#", ""):gsub("0x", "")
	if #str ~= 6 then
		return nil
	end

	local r = tonumber(str:sub(1, 2), 16)
	local g = tonumber(str:sub(3, 4), 16)
	local b = tonumber(str:sub(5, 6), 16)

	if r and g and b then
		return Color3.fromRGB(r, g, b)
	end

	return nil
end

local function applyFog()
	if fogEnabled then
		Lighting.FogStart = 0
		Lighting.FogEnd = 140
		Lighting.FogColor = fogColor
	else
		Lighting.FogStart = defaultFog.FogStart
		Lighting.FogEnd = defaultFog.FogEnd
		Lighting.FogColor = defaultFog.FogColor
	end
end

local function makeGlassFrame(parent, height)
	local frame = Instance.new("Frame")
	frame.Parent = parent
	frame.Size = UDim2.new(1, 0, 0, height)
	frame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
	frame.BackgroundTransparency = 0.92

	local corner = Instance.new("UICorner")
	corner.CornerRadius = UDim.new(0, 14)
	corner.Parent = frame

	local stroke = Instance.new("UIStroke")
	stroke.Color = Color3.fromRGB(255, 90, 170)
	stroke.Transparency = 0.35
	stroke.Thickness = 1
	stroke.Parent = frame

	return frame
end

local function makeFogToggleRow()
	local row = makeGlassFrame(content, 54)

	local label = Instance.new("TextLabel")
	label.Parent = row
	label.BackgroundTransparency = 1
	label.Position = UDim2.new(0, 12, 0, 0)
	label.Size = UDim2.new(1, -110, 1, 0)
	label.TextXAlignment = Enum.TextXAlignment.Left
	label.Text = "Fog"
	label.Font = Enum.Font.GothamSemibold
	label.TextSize = 14
	label.TextColor3 = Color3.fromRGB(255, 235, 245)

	local desc = Instance.new("TextLabel")
	desc.Parent = row
	desc.BackgroundTransparency = 1
	desc.Position = UDim2.new(0, 12, 0, 22)
	desc.Size = UDim2.new(1, -110, 0, 18)
	desc.TextXAlignment = Enum.TextXAlignment.Left
	desc.Text = "Toggle world fog on/off"
	desc.Font = Enum.Font.Gotham
	desc.TextSize = 11
	desc.TextColor3 = Color3.fromRGB(255, 200, 225)
	desc.TextTransparency = 0.15

	local toggle = Instance.new("TextButton")
	toggle.Parent = row
	toggle.Size = UDim2.new(0, 72, 0, 30)
	toggle.Position = UDim2.new(1, -84, 0.5, -15)
	toggle.AutoButtonColor = false
	toggle.Font = Enum.Font.GothamBold
	toggle.TextSize = 13
	toggle.TextColor3 = Color3.fromRGB(255, 245, 250)
	toggle.BorderSizePixel = 0

	local corner = Instance.new("UICorner")
	corner.CornerRadius = UDim.new(0, 12)
	corner.Parent = toggle

	local function refresh()
		if fogEnabled then
			toggle.Text = "ON"
			toggle.BackgroundColor3 = Color3.fromRGB(255, 70, 150)
		else
			toggle.Text = "OFF"
			toggle.BackgroundColor3 = Color3.fromRGB(35, 35, 40)
		end
	end

	toggle.MouseButton1Click:Connect(function()
		fogEnabled = not fogEnabled
		applyFog()
		refresh()
	end)

	refresh()
	return row
end

local function makeFogColorRow()
	local row = makeGlassFrame(content, 60)

	local label = Instance.new("TextLabel")
	label.Parent = row
	label.BackgroundTransparency = 1
	label.Position = UDim2.new(0, 12, 0, 6)
	label.Size = UDim2.new(1, -24, 0, 16)
	label.TextXAlignment = Enum.TextXAlignment.Left
	label.Text = "Fog Color"
	label.Font = Enum.Font.GothamSemibold
	label.TextSize = 14
	label.TextColor3 = Color3.fromRGB(255, 235, 245)

	local input = Instance.new("TextBox")
	input.Parent = row
	input.Size = UDim2.new(1, -120, 0, 28)
	input.Position = UDim2.new(0, 12, 0, 28)
	input.BackgroundColor3 = Color3.fromRGB(28, 28, 34)
	input.BackgroundTransparency = 0.1
	input.BorderSizePixel = 0
	input.PlaceholderText = "#FF5AAE"
	input.Text = "#FF5AAE"
	input.ClearTextOnFocus = false
	input.Font = Enum.Font.Gotham
	input.TextSize = 13
	input.TextColor3 = Color3.fromRGB(255, 235, 245)
	input.PlaceholderColor3 = Color3.fromRGB(200, 170, 190)

	local inputCorner = Instance.new("UICorner")
	inputCorner.CornerRadius = UDim.new(0, 10)
	inputCorner.Parent = input

	local inputStroke = Instance.new("UIStroke")
	inputStroke.Color = Color3.fromRGB(255, 90, 170)
	inputStroke.Transparency = 0.5
	inputStroke.Thickness = 1
	inputStroke.Parent = input

	local apply = Instance.new("TextButton")
	apply.Parent = row
	apply.Size = UDim2.new(0, 86, 0, 28)
	apply.Position = UDim2.new(1, -98, 0, 28)
	apply.AutoButtonColor = false
	apply.BorderSizePixel = 0
	apply.Text = "Apply"
	apply.Font = Enum.Font.GothamBold
	apply.TextSize = 13
	apply.TextColor3 = Color3.fromRGB(255, 245, 250)
	apply.BackgroundColor3 = Color3.fromRGB(255, 70, 150)

	local applyCorner = Instance.new("UICorner")
	applyCorner.CornerRadius = UDim.new(0, 10)
	applyCorner.Parent = apply

	apply.MouseButton1Click:Connect(function()
		local c = parseHexColor(input.Text)
		if c then
			fogColor = c
			if fogEnabled then
				applyFog()
			end
			apply.Text = "Applied"
		else
			apply.Text = "Invalid"
		end

		task.delay(0.8, function()
			if apply and apply.Parent then
				apply.Text = "Apply"
			end
		end)
	end)

	input.FocusLost:Connect(function()
		local c = parseHexColor(input.Text)
		if c then
			fogColor = c
			if fogEnabled then
				applyFog()
			end
		end
	end)

	return row
end

-- Add the fog controls to your menu
makeInfoBox("Fog controls with custom color. Use hex like #FF5AAE.").Parent = content
makeFogToggleRow().Parent = content
makeFogColorRow().Parent = content