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


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

local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

-- ScreenGui
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "CoolWindow"
screenGui.ResetOnSpawn = false
screenGui.IgnoreGuiInset = true
screenGui.Parent = playerGui

-- ===== ЧЁРНЫЙ ЭКРАН ЗАГРУЗКИ =====
local loadingScreen = Instance.new("Frame")
loadingScreen.Name = "LoadingScreen"
loadingScreen.Size = UDim2.new(1, 0, 1, 0)
loadingScreen.BackgroundColor3 = Color3.new(0, 0, 0)
loadingScreen.BackgroundTransparency = 1
loadingScreen.ZIndex = 10
loadingScreen.Parent = screenGui

local loadingIcon = Instance.new("ImageLabel")
loadingIcon.Size = UDim2.new(0, 150, 0, 150)
loadingIcon.Position = UDim2.new(0.5, 0, 0.5, 0)
loadingIcon.AnchorPoint = Vector2.new(0.5, 0.5)
loadingIcon.BackgroundTransparency = 1
loadingIcon.Image = "rbxassetid://140143358421928"
loadingIcon.ImageTransparency = 1
loadingIcon.ZIndex = 11
loadingIcon.Parent = loadingScreen

-- ===== ОСНОВНОЕ ОКНО (горизонтальный прямоугольник) =====
local window = Instance.new("Frame")
window.Name = "MainWindow"
window.Size = UDim2.new(0, 600, 0, 320)
window.Position = UDim2.new(0.5, 0, 0.5, 0)
window.AnchorPoint = Vector2.new(0.5, 0.5)
window.BackgroundColor3 = Color3.fromRGB(30, 30, 35)
window.BorderSizePixel = 0
window.ZIndex = 2
window.Visible = false
window.Parent = screenGui

local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 24)
corner.Parent = window

local stroke = Instance.new("UIStroke")
stroke.Color = Color3.fromRGB(90, 120, 255)
stroke.Thickness = 2
stroke.Transparency = 0.3
stroke.Parent = window

local gradient = Instance.new("UIGradient")
gradient.Color = ColorSequence.new({
    ColorSequenceKeypoint.new(0, Color3.fromRGB(45, 45, 60)),
    ColorSequenceKeypoint.new(1, Color3.fromRGB(20, 20, 25))
})
gradient.Rotation = 90
gradient.Parent = window

-- Кнопка закрытия
local closeButton = Instance.new("TextButton")
closeButton.Size = UDim2.new(0, 36, 0, 36)
closeButton.Position = UDim2.new(1, -46, 0, 10)
closeButton.BackgroundColor3 = Color3.fromRGB(255, 70, 70)
closeButton.Text = ""
closeButton.ZIndex = 3
closeButton.Parent = window

local closeCorner = Instance.new("UICorner")
closeCorner.CornerRadius = UDim.new(1, 0)
closeCorner.Parent = closeButton

local line1 = Instance.new("Frame")
line1.Size = UDim2.new(0, 16, 0, 2)
line1.Position = UDim2.new(0.5, 0, 0.5, 0)
line1.AnchorPoint = Vector2.new(0.5, 0.5)
line1.BackgroundColor3 = Color3.new(1, 1, 1)
line1.Rotation = 45
line1.ZIndex = 4
line1.Parent = closeButton

local line2 = line1:Clone()
line2.Rotation = -45
line2.Parent = closeButton

-- ===== АНИМАЦИЯ ЗАГРУЗОЧНОГО ЭКРАНА =====
-- Плавное появление чёрного фона и иконки
TweenService:Create(loadingScreen, TweenInfo.new(0.4), {BackgroundTransparency = 0}):Play()
TweenService:Create(loadingIcon, TweenInfo.new(0.5), {ImageTransparency = 0}):Play()

-- Держим экран 2-3 секунды
task.wait(2.5)

-- Плавно скрываем чёрный экран
local hideBg = TweenService:Create(loadingScreen, TweenInfo.new(0.5), {BackgroundTransparency = 1})
local hideIcon = TweenService:Create(loadingIcon, TweenInfo.new(0.5), {ImageTransparency = 1})
hideBg:Play()
hideIcon:Play()
hideBg.Completed:Wait()
loadingScreen:Destroy()

-- ===== АНИМАЦИЯ ПОЯВЛЕНИЯ ОКНА =====
window.Visible = true
window.Size = UDim2.new(0, 0, 0, 0)
window.BackgroundTransparency = 1
stroke.Transparency = 1

local windowTween = TweenService:Create(
    window,
    TweenInfo.new(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.Out),
    {
        Size = UDim2.new(0, 600, 0, 320),
        BackgroundTransparency = 0
    }
)
windowTween:Play()

task.wait(0.2)
TweenService:Create(stroke, TweenInfo.new(0.4), {Transparency = 0.3}):Play()

-- ===== ЗАКРЫТИЕ ОКНА =====
closeButton.MouseButton1Click:Connect(function()
    local closeTween = TweenService:Create(
        window,
        TweenInfo.new(0.3, Enum.EasingStyle.Back, Enum.EasingDirection.In),
        {
            Size = UDim2.new(0, 0, 0, 0),
            BackgroundTransparency = 1
        }
    )
    closeTween:Play()
    closeTween.Completed:Wait()
    screenGui:Destroy()
end)