CCCPaste

rasvet-hub

-- rasvet-hub V2.0
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local Lighting = game:GetService("Lighting")
local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera
local Mouse = LocalPlayer:GetMouse()

-- Orange Theme
local THEME = {
    Primary = Color3.fromRGB(255, 140, 0),
    Secondary = Color3.fromRGB(255, 165, 0),
    Dark = Color3.fromRGB(200, 100, 0),
    Light = Color3.fromRGB(255, 200, 100),
    Background = Color3.fromRGB(20, 20, 20),
    Header = Color3.fromRGB(30, 30, 30),
    Section = Color3.fromRGB(35, 35, 35)
}

-- Enhanced Module System
local Modules = {
    Movement = {
        Fly = false,
        FlySpeed = 50,
        Noclip = false,
        InfiniteJump = false,
        SpeedHack = false,
        SpeedValue = 50,
        JumpPower = false,
        JumpValue = 100,
        KeyBinds = {
            SpeedHack = nil,
            Fly = nil,
            Noclip = nil,
            InfiniteJump = nil
        }
    },
    Visuals = {
        PlayerESP = false,
        BoxESP = false,
        Tracers = false,
        HealthBar = false,
        Distance = true,
        Chams = false,
        XRay = false,
        NightVision = false,
        Fullbright = false,
        NoFog = false
    },
    World = {
        NoBoundaries = false,
        FreezeTime = false,
        TimeValue = 12,
        GravityValue = 196
    },
    Utility = {
        AntiAFK = true,
        ChatSpam = false,
        AutoClicker = false,
        ClickSpeed = 20,
        AntiFling = false,
        KeyBinds = {
            AutoClicker = nil
        }
    },
    Fun = {
        SpinBot = false,
        SpinBotSettings = {
            Speed = 30,
            Yaw = true,
            Pitch = false,
            Roll = false,
            YawSpeed = 5,
            PitchSpeed = 3,
            RollSpeed = 2,
            Randomize = false,
            Direction = 1
        },
        Desync = false,
        DesyncSettings = {
            MinRadius = 5,
            MaxRadius = 20,
            Height = 10,
            TeleportBack = true
        }
    }
}

-- ESP System Variables
local ESPEnabled = false
local ESPObjects = {}
local BoxESPObjects = {}
local TracerObjects = {}
local HealthBarObjects = {}
local ChamObjects = {}
local ESPConnections = {}

-- Desync System Variables
local DesyncConnection
local OriginalPosition
local PhantomCharacter

-- Anti-Fling System
local AntiFlingConnection

-- Protection System
local function ProtectGUI(gui)
    if PROTECT_GUI then
        PROTECT_GUI(gui)
    elseif gethui then
        gui.Parent = gethui()
    elseif syn and syn.protect_gui then
        syn.protect_gui(gui)
        gui.Parent = game.CoreGui
    else
        gui.Parent = game.CoreGui
    end
end

-- Create Main UI
local MainUI = Instance.new("ScreenGui")
MainUI.Name = "RasvetHub"
ProtectGUI(MainUI)

-- Main Container
local MainContainer = Instance.new("Frame")
MainContainer.Size = UDim2.new(0, 450, 0, 600)
MainContainer.Position = UDim2.new(0.5, -225, 0.5, -300)
MainContainer.BackgroundColor3 = THEME.Background
MainContainer.BorderSizePixel = 0
MainContainer.Parent = MainUI

local MainCorner = Instance.new("UICorner")
MainCorner.CornerRadius = UDim.new(0, 12)
MainCorner.Parent = MainContainer

-- Header with Status
local Header = Instance.new("Frame")
Header.Size = UDim2.new(1, 0, 0, 50)
Header.BackgroundColor3 = THEME.Header
Header.BorderSizePixel = 0
Header.Parent = MainContainer

local HeaderCorner = Instance.new("UICorner")
HeaderCorner.CornerRadius = UDim.new(0, 12)
HeaderCorner.Parent = Header

local Logo = Instance.new("TextLabel")
Logo.Size = UDim2.new(0.6, 0, 1, 0)
Logo.Position = UDim2.new(0, 15, 0, 0)
Logo.BackgroundTransparency = 1
Logo.Text = "rasvet-hub V2.0"
Logo.TextColor3 = THEME.Primary
Logo.TextSize = 18
Logo.Font = Enum.Font.GothamBlack
Logo.TextXAlignment = Enum.TextXAlignment.Left
Logo.Parent = Header

-- Fixed Blinking Online Status (moved left)
local StatusIndicator = Instance.new("Frame")
StatusIndicator.Size = UDim2.new(0, 12, 0, 12)
StatusIndicator.Position = UDim2.new(0.78, 0, 0.5, -6)
StatusIndicator.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
StatusIndicator.BorderSizePixel = 0
StatusIndicator.Parent = Header

local StatusCorner = Instance.new("UICorner")
StatusCorner.CornerRadius = UDim.new(1, 0)
StatusCorner.Parent = StatusIndicator

local StatusLabel = Instance.new("TextLabel")
StatusLabel.Size = UDim2.new(0, 50, 0, 20)
StatusLabel.Position = UDim2.new(0.8, 0, 0.5, -10)
StatusLabel.BackgroundTransparency = 1
StatusLabel.Text = "Online"
StatusLabel.TextColor3 = Color3.fromRGB(0, 255, 0)
StatusLabel.TextSize = 12
StatusLabel.Font = Enum.Font.GothamBold
StatusLabel.Parent = Header

-- Blinking animation
spawn(function()
    while true do
        for i = 1, 0, -0.1 do
            StatusIndicator.BackgroundTransparency = i
            wait(0.1)
        end
        for i = 0, 1, 0.1 do
            StatusIndicator.BackgroundTransparency = i
            wait(0.1)
        end
    end
end)

local CloseButton = Instance.new("TextButton")
CloseButton.Size = UDim2.new(0, 30, 0, 30)
CloseButton.Position = UDim2.new(1, -35, 0.5, -15)
CloseButton.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
CloseButton.TextColor3 = THEME.Primary
CloseButton.TextSize = 16
CloseButton.Font = Enum.Font.GothamBold
CloseButton.Text = "×"
CloseButton.Parent = Header

local CloseCorner = Instance.new("UICorner")
CloseCorner.CornerRadius = UDim.new(0, 6)
CloseCorner.Parent = CloseButton

-- Tab System
local TabsContainer = Instance.new("Frame")
TabsContainer.Size = UDim2.new(1, -20, 0, 35)
TabsContainer.Position = UDim2.new(0, 10, 0, 55)
TabsContainer.BackgroundTransparency = 1
TabsContainer.Parent = MainContainer

local TabContent = Instance.new("Frame")
TabContent.Size = UDim2.new(1, -20, 1, -100)
TabContent.Position = UDim2.new(0, 10, 0, 95)
TabContent.BackgroundTransparency = 1
TabContent.Parent = MainContainer

local Tabs = {"Movement", "Visuals", "World", "Utility", "Fun"}
local TabFrames = {}
local TabButtons = {}

for i, tabName in ipairs(Tabs) do
    local TabButton = Instance.new("TextButton")
    TabButton.Size = UDim2.new(0.19, 0, 1, 0)
    TabButton.Position = UDim2.new(0.2 * (i-1), 0, 0, 0)
    TabButton.BackgroundColor3 = i == 1 and THEME.Dark or Color3.fromRGB(45, 45, 45)
    TabButton.Text = tabName
    TabButton.TextColor3 = Color3.fromRGB(255, 255, 255)
    TabButton.TextSize = 13
    TabButton.Font = Enum.Font.GothamBold
    TabButton.Parent = TabsContainer
    
    local TabCorner = Instance.new("UICorner")
    TabCorner.CornerRadius = UDim.new(0, 6)
    TabCorner.Parent = TabButton
    
    local TabFrame = Instance.new("ScrollingFrame")
    TabFrame.Size = UDim2.new(1, 0, 1, 0)
    TabFrame.BackgroundTransparency = 1
    TabFrame.ScrollBarThickness = 4
    TabFrame.ScrollBarImageColor3 = THEME.Primary
    TabFrame.Visible = i == 1
    TabFrame.AutomaticCanvasSize = Enum.AutomaticSize.Y
    TabFrame.Parent = TabContent
    
    local UIListLayout = Instance.new("UIListLayout")
    UIListLayout.Padding = UDim.new(0, 8)
    UIListLayout.Parent = TabFrame
    
    TabFrames[tabName] = TabFrame
    TabButtons[tabName] = TabButton
    
    TabButton.MouseButton1Click:Connect(function()
        for _, frame in pairs(TabFrames) do
            frame.Visible = false
        end
        TabFrame.Visible = true
        
        for _, btn in pairs(TabButtons) do
            btn.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
        end
        TabButton.BackgroundColor3 = THEME.Dark
    end)
end

-- UI Creation Functions
local function CreateSection(title, parent)
    local Section = Instance.new("Frame")
    Section.Size = UDim2.new(1, 0, 0, 35)
    Section.BackgroundColor3 = THEME.Section
    Section.BorderSizePixel = 0
    Section.Parent = parent
    
    local SectionCorner = Instance.new("UICorner")
    SectionCorner.CornerRadius = UDim.new(0, 6)
    SectionCorner.Parent = Section
    
    local SectionLabel = Instance.new("TextLabel")
    SectionLabel.Size = UDim2.new(1, -20, 1, 0)
    SectionLabel.Position = UDim2.new(0, 10, 0, 0)
    SectionLabel.BackgroundTransparency = 1
    SectionLabel.Text = "✦ " .. title
    SectionLabel.TextColor3 = THEME.Primary
    SectionLabel.TextSize = 14
    SectionLabel.Font = Enum.Font.GothamBold
    SectionLabel.TextXAlignment = Enum.TextXAlignment.Left
    SectionLabel.Parent = Section
    
    return Section
end

-- KeyBind System
local KeyBindInputActive = false
local CurrentKeyBindFrame = nil
local CurrentKeyBindData = nil

local function CreateKeyBind(parent, module, keyName)
    local KeyBindFrame = Instance.new("Frame")
    KeyBindFrame.Size = UDim2.new(0, 60, 0, 25)
    KeyBindFrame.Position = UDim2.new(1, -70, 0.5, -12.5)
    KeyBindFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
    KeyBindFrame.BorderSizePixel = 0
    KeyBindFrame.Parent = parent
    
    local KeyBindCorner = Instance.new("UICorner")
    KeyBindCorner.CornerRadius = UDim.new(0, 4)
    KeyBindCorner.Parent = KeyBindFrame
    
    local KeyBindButton = Instance.new("TextButton")
    KeyBindButton.Size = UDim2.new(1, 0, 1, 0)
    KeyBindButton.BackgroundTransparency = 1
    KeyBindButton.Text = "[ ... ]"
    KeyBindButton.TextColor3 = THEME.Primary
    KeyBindButton.TextSize = 11
    KeyBindButton.Font = Enum.Font.GothamBold
    KeyBindButton.Parent = KeyBindFrame
    
    -- KeyBind input handler
    KeyBindButton.MouseButton1Click:Connect(function()
        KeyBindInputActive = true
        CurrentKeyBindFrame = KeyBindFrame
        CurrentKeyBindData = {module = module, keyName = keyName}
        KeyBindButton.Text = "[ ? ]"
    end)
    
    return KeyBindFrame
end

local function CreateToggle(name, parent, default, callback, hasKeyBind, module, keyName)
    local ToggleFrame = Instance.new("Frame")
    ToggleFrame.Size = UDim2.new(1, 0, 0, 30)
    ToggleFrame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
    ToggleFrame.BorderSizePixel = 0
    ToggleFrame.Parent = parent
    
    local ToggleCorner = Instance.new("UICorner")
    ToggleCorner.CornerRadius = UDim.new(0, 6)
    ToggleCorner.Parent = ToggleFrame
    
    local ToggleLabel = Instance.new("TextLabel")
    ToggleLabel.Size = UDim2.new(hasKeyBind and 0.6 or 0.7, 0, 1, 0)
    ToggleLabel.Position = UDim2.new(0, 10, 0, 0)
    ToggleLabel.BackgroundTransparency = 1
    ToggleLabel.Text = name
    ToggleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
    ToggleLabel.TextSize = 13
    ToggleLabel.TextXAlignment = Enum.TextXAlignment.Left
    ToggleLabel.Font = Enum.Font.Gotham
    ToggleLabel.Parent = ToggleFrame
    
    local ToggleButton = Instance.new("TextButton")
    ToggleButton.Size = UDim2.new(0, 40, 0, 20)
    ToggleButton.Position = UDim2.new(hasKeyBind and 0.75 or 1, hasKeyBind and -105 or -45, 0.5, -10)
    ToggleButton.BackgroundColor3 = default and THEME.Primary or Color3.fromRGB(60, 60, 60)
    ToggleButton.Text = ""
    ToggleButton.Parent = ToggleFrame
    
    local ToggleCorner2 = Instance.new("UICorner")
    ToggleCorner2.CornerRadius = UDim.new(0, 10)
    ToggleCorner2.Parent = ToggleButton
    
    local ToggleValue = default
    
    ToggleButton.MouseButton1Click:Connect(function()
        ToggleValue = not ToggleValue
        ToggleButton.BackgroundColor3 = ToggleValue and THEME.Primary or Color3.fromRGB(60, 60, 60)
        if callback then
            callback(ToggleValue)
        end
    end)
    
    -- Add KeyBind if needed
    if hasKeyBind and module and keyName then
        CreateKeyBind(ToggleFrame, module, keyName)
    end
    
    return ToggleFrame
end

-- Global KeyBind input handler
UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    
    if KeyBindInputActive and CurrentKeyBindFrame and input.UserInputType == Enum.UserInputType.Keyboard then
        local key = input.KeyCode.Name
        local keyButton = CurrentKeyBindFrame:FindFirstChildOfClass("TextButton")
        
        if keyButton then
            keyButton.Text = "["..key.."]"
            
            -- Update the keybind in modules
            if CurrentKeyBindData then
                CurrentKeyBindData.module.KeyBinds[CurrentKeyBindData.keyName] = key
            end
        end
        
        KeyBindInputActive = false
        CurrentKeyBindFrame = nil
        CurrentKeyBindData = nil
        return
    end
    
    -- Handle keybind activation
    if input.UserInputType == Enum.UserInputType.Keyboard then
        local key = input.KeyCode.Name
        
        -- Check all keybinds and toggle corresponding functions
        for categoryName, category in pairs(Modules) do
            if category.KeyBinds then
                for funcName, bindKey in pairs(category.KeyBinds) do
                    if bindKey == key then
                        -- Toggle the function
                        category[funcName] = not category[funcName]
                        
                        -- Execute corresponding function
                        if categoryName == "Movement" then
                            if funcName == "SpeedHack" then
                                if LocalPlayer.Character then
                                    local humanoid = LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
                                    if humanoid then
                                        humanoid.WalkSpeed = category.SpeedHack and category.SpeedValue or 16
                                    end
                                end
                            elseif funcName == "Fly" then
                                if category.Fly then
                                    EnableFly()
                                else
                                    DisableFly()
                                end
                            elseif funcName == "Noclip" then
                                if category.Noclip then
                                    EnableNoclip()
                                else
                                    DisableNoclip()
                                end
                            elseif funcName == "InfiniteJump" then
                                -- InfiniteJump handled separately
                            end
                        elseif categoryName == "Utility" then
                            if funcName == "AutoClicker" then
                                if category.AutoClicker then
                                    EnableAutoClicker()
                                else
                                    DisableAutoClicker()
                                end
                            end
                        elseif categoryName == "Fun" then
                            if funcName == "SpinBot" then
                                if category.SpinBot then
                                    EnableSpinBot()
                                else
                                    DisableSpinBot()
                                end
                            end
                        end
                    end
                end
            end
        end
    end
end)

local function CreateSlider(name, parent, min, max, default, callback)
    local SliderFrame = Instance.new("Frame")
    SliderFrame.Size = UDim2.new(1, 0, 0, 50)
    SliderFrame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
    SliderFrame.BorderSizePixel = 0
    SliderFrame.Parent = parent
    
    local SliderCorner = Instance.new("UICorner")
    SliderCorner.CornerRadius = UDim.new(0, 6)
    SliderCorner.Parent = SliderFrame
    
    local SliderLabel = Instance.new("TextLabel")
    SliderLabel.Size = UDim2.new(1, -20, 0, 20)
    SliderLabel.Position = UDim2.new(0, 10, 0, 5)
    SliderLabel.BackgroundTransparency = 1
    SliderLabel.Text = name .. ": " .. default
    SliderLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
    SliderLabel.TextSize = 12
    SliderLabel.TextXAlignment = Enum.TextXAlignment.Left
    SliderLabel.Font = Enum.Font.Gotham
    SliderLabel.Parent = SliderFrame
    
    local SliderBar = Instance.new("Frame")
    SliderBar.Size = UDim2.new(1, -20, 0, 4)
    SliderBar.Position = UDim2.new(0, 10, 0, 32)
    SliderBar.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
    SliderBar.BorderSizePixel = 0
    SliderBar.Parent = SliderFrame
    
    local SliderBarCorner = Instance.new("UICorner")
    SliderBarCorner.CornerRadius = UDim.new(0, 2)
    SliderBarCorner.Parent = SliderBar
    
    local SliderFill = Instance.new("Frame")
    SliderFill.Size = UDim2.new((default - min) / (max - min), 0, 1, 0)
    SliderFill.BackgroundColor3 = THEME.Primary
    SliderFill.BorderSizePixel = 0
    SliderFill.Parent = SliderBar
    
    local SliderFillCorner = Instance.new("UICorner")
    SliderFillCorner.CornerRadius = UDim.new(0, 2)
    SliderFillCorner.Parent = SliderFill
    
    local dragging = false
    local currentValue = default
    
    local function updateSlider(input)
        local mousePos = input.Position
        local sliderPos = SliderBar.AbsolutePosition
        local sliderSize = SliderBar.AbsoluteSize
        
        local relativeX = math.clamp((mousePos.X - sliderPos.X) / sliderSize.X, 0, 1)
        currentValue = math.floor(min + relativeX * (max - min))
        
        SliderLabel.Text = name .. ": " .. currentValue
        SliderFill.Size = UDim2.new(relativeX, 0, 1, 0)
        
        if callback then
            callback(currentValue)
        end
    end
    
    SliderBar.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 then
            dragging = true
            updateSlider(input)
        end
    end)
    
    SliderBar.InputEnded:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 then
            dragging = false
        end
    end)
    
    UserInputService.InputChanged:Connect(function(input)
        if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
            updateSlider(input)
        end
    end)
    
    return SliderFrame
end

-- Create All Functions
local movementTab = TabFrames["Movement"]
local visualsTab = TabFrames["Visuals"]
local worldTab = TabFrames["World"]
local utilityTab = TabFrames["Utility"]
local funTab = TabFrames["Fun"]

-- Movement Functions with KeyBinds
CreateSection("Movement", movementTab)
CreateToggle("Speed Hack", movementTab, false, function(value)
    Modules.Movement.SpeedHack = value
    if LocalPlayer.Character then
        local humanoid = LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
        if humanoid then
            humanoid.WalkSpeed = value and Modules.Movement.SpeedValue or 16
        end
    end
end, true, Modules.Movement, "SpeedHack")

CreateSlider("Speed Value", movementTab, 16, 200, 50, function(value)
    Modules.Movement.SpeedValue = value
    if Modules.Movement.SpeedHack and LocalPlayer.Character then
        local humanoid = LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
        if humanoid then
            humanoid.WalkSpeed = value
        end
    end
end)

CreateToggle("Fly Mode", movementTab, false, function(value)
    Modules.Movement.Fly = value
    if value then
        EnableFly()
    else
        DisableFly()
    end
end, true, Modules.Movement, "Fly")

CreateSlider("Fly Speed", movementTab, 10, 200, 50, function(value)
    Modules.Movement.FlySpeed = value
end)

CreateToggle("Noclip", movementTab, false, function(value)
    Modules.Movement.Noclip = value
    if value then
        EnableNoclip()
    else
        DisableNoclip()
    end
end, true, Modules.Movement, "Noclip")

CreateToggle("Infinite Jump", movementTab, false, function(value)
    Modules.Movement.InfiniteJump = value
end, true, Modules.Movement, "InfiniteJump")

-- FIXED Visuals Functions
CreateSection("Player ESP", visualsTab)
CreateToggle("Player ESP", visualsTab, false, function(value)
    Modules.Visuals.PlayerESP = value
    if value then
        EnablePlayerESP()
    else
        DisablePlayerESP()
    end
end)

CreateToggle("Box ESP", visualsTab, false, function(value)
    Modules.Visuals.BoxESP = value
    if value then
        EnableBoxESP()
    else
        DisableBoxESP()
    end
end)

CreateToggle("Tracers", visualsTab, false, function(value)
    Modules.Visuals.Tracers = value
    if value then
        EnableTracers()
    else
        DisableTracers()
    end
end)

CreateToggle("Health Bar", visualsTab, false, function(value)
    Modules.Visuals.HealthBar = value
    if value then
        EnableHealthBar()
    else
        DisableHealthBar()
    end
end)

CreateToggle("Chams", visualsTab, false, function(value)
    Modules.Visuals.Chams = value
    if value then
        EnableChams()
    else
        DisableChams()
    end
end)

CreateSection("World Visuals", visualsTab)
CreateToggle("X-Ray", visualsTab, false, function(value)
    Modules.Visuals.XRay = value
    if value then
        EnableXRay()
    else
        DisableXRay()
    end
end)

CreateToggle("Night Vision", visualsTab, false, function(value)
    Modules.Visuals.NightVision = value
    if value then
        EnableNightVision()
    else
        DisableNightVision()
    end
end)

CreateToggle("Fullbright", visualsTab, false, function(value)
    Modules.Visuals.Fullbright = value
    if value then
        EnableFullbright()
    else
        DisableFullbright()
    end
end)

CreateToggle("No Fog", visualsTab, false, function(value)
    Modules.Visuals.NoFog = value
    if value then
        Lighting.FogEnd = 100000
    else
        Lighting.FogEnd = 1000
    end
end)

CreateSlider("FOV Changer", visualsTab, 70, 120, 80, function(value)
    if Camera then
        Camera.FieldOfView = value
    end
end)

-- World Functions
CreateSection("Environment", worldTab)
CreateSlider("Time of Day", worldTab, 0, 24, 12, function(value)
    Modules.World.TimeValue = value
    if not Modules.World.FreezeTime then
        Lighting.ClockTime = value
    end
end)

CreateToggle("Freeze Time", worldTab, false, function(value)
    Modules.World.FreezeTime = value
    if value then
        Lighting.ClockTime = Modules.World.TimeValue
    end
end)

CreateSlider("Gravity", worldTab, 0, 500, 196, function(value)
    Modules.World.GravityValue = value
    workspace.Gravity = value
end)

CreateToggle("No Boundaries", worldTab, false, function(value)
    Modules.World.NoBoundaries = value
end)

-- Utility Functions
CreateSection("Utility", utilityTab)
CreateToggle("Anti-AFK", utilityTab, true, function(value)
    Modules.Utility.AntiAFK = value
end)

CreateToggle("Chat Spam", utilityTab, false, function(value)
    Modules.Utility.ChatSpam = value
    if value then
        EnableChatSpam()
    else
        DisableChatSpam()
    end
end)

CreateToggle("Auto Clicker", utilityTab, false, function(value)
    Modules.Utility.AutoClicker = value
    if value then
        EnableAutoClicker()
    else
        DisableAutoClicker()
    end
end, true, Modules.Utility, "AutoClicker")

CreateToggle("Anti-Fling", utilityTab, false, function(value)
    Modules.Utility.AntiFling = value
    if value then
        EnableAntiFling()
    else
        DisableAntiFling()
    end
end)

CreateSlider("Click Speed", utilityTab, 1, 100, 20, function(value)
    Modules.Utility.ClickSpeed = value
end)

-- IMPROVED Fun Functions - Only SpinBot and Desync
CreateSection("Spin Bot", funTab)
CreateToggle("Spin Bot", funTab, false, function(value)
    Modules.Fun.SpinBot = value
    if value then
        EnableSpinBot()
    else
        DisableSpinBot()
    end
end, true, Modules.Fun, "SpinBot")

CreateSlider("Spin Speed", funTab, 1, 100, 30, function(value)
    Modules.Fun.SpinBotSettings.Speed = value
end)

CreateToggle("Yaw Rotation", funTab, true, function(value)
    Modules.Fun.SpinBotSettings.Yaw = value
end)

CreateToggle("Pitch Rotation", funTab, false, function(value)
    Modules.Fun.SpinBotSettings.Pitch = value
end)

CreateToggle("Roll Rotation", funTab, false, function(value)
    Modules.Fun.SpinBotSettings.Roll = value
end)

CreateSlider("Yaw Speed", funTab, 1, 20, 5, function(value)
    Modules.Fun.SpinBotSettings.YawSpeed = value
end)

CreateSlider("Pitch Speed", funTab, 1, 20, 3, function(value)
    Modules.Fun.SpinBotSettings.PitchSpeed = value
end)

CreateSlider("Roll Speed", funTab, 1, 20, 2, function(value)
    Modules.Fun.SpinBotSettings.RollSpeed = value
end)

CreateToggle("Randomize Spin", funTab, false, function(value)
    Modules.Fun.SpinBotSettings.Randomize = value
end)

CreateToggle("Clockwise", funTab, true, function(value)
    Modules.Fun.SpinBotSettings.Direction = value and 1 or -1
end)

CreateSection("Desync", funTab)
CreateToggle("Desync", funTab, false, function(value)
    Modules.Fun.Desync = value
    if value then
        EnableDesync()
    else
        DisableDesync()
    end
end)

CreateSlider("Min Radius", funTab, 1, 50, 5, function(value)
    Modules.Fun.DesyncSettings.MinRadius = value
end)

CreateSlider("Max Radius", funTab, 5, 100, 20, function(value)
    Modules.Fun.DesyncSettings.MaxRadius = value
end)

CreateSlider("Height", funTab, 0, 50, 10, function(value)
    Modules.Fun.DesyncSettings.Height = value
end)

CreateToggle("Auto Return", funTab, true, function(value)
    Modules.Fun.DesyncSettings.TeleportBack = value
end)

-- COMPLETELY REWORKED ESP SYSTEM
function EnablePlayerESP()
    ESPEnabled = true
    
    local function createESPForPlayer(player)
        if player == LocalPlayer then return end
        
        local function setupCharacter(character)
            if not character or not ESPEnabled then return end
            
            -- Wait for character to load
            local humanoidRootPart = character:WaitForChild("HumanoidRootPart", 2)
            local head = character:WaitForChild("Head", 2)
            local humanoid = character:WaitForChild("Humanoid", 2)
            
            if not humanoidRootPart or not head then return end
            
            -- Create Name ESP
            if Modules.Visuals.PlayerESP then
                CreateNameESP(character, player)
            end
            
            -- Create Box ESP
            if Modules.Visuals.BoxESP then
                CreateBoxESP(character, player)
            end
            
            -- Create Tracers
            if Modules.Visuals.Tracers then
                CreateTracer(character, player)
            end
            
            -- Create Health Bar
            if Modules.Visuals.HealthBar then
                CreateHealthBar(character, player)
            end
            
            -- Create Chams
            if Modules.Visuals.Chams then
                CreateChams(character, player)
            end
        end
        
        -- Setup current character
        if player.Character then
            setupCharacter(player.Character)
        end
        
        -- Track character changes
        if not ESPConnections[player] then
            ESPConnections[player] = player.CharacterAdded:Connect(function(character)
                if ESPEnabled then
                    setupCharacter(character)
                end
            end)
        end
    end
    
    -- Clear existing ESP
    DisablePlayerESP()
    ESPEnabled = true
    
    -- Create ESP for all players
    for _, player in pairs(Players:GetPlayers()) do
        createESPForPlayer(player)
    end
    
    -- Track new players
    ESPConnections.PlayerAdded = Players.PlayerAdded:Connect(function(player)
        createESPForPlayer(player)
    end)
    
    -- Track when players leave
    ESPConnections.PlayerRemoving = Players.PlayerRemoving:Connect(function(player)
        if ESPConnections[player] then
            ESPConnections[player]:Disconnect()
            ESPConnections[player] = nil
        end
    end)
end

function DisablePlayerESP()
    ESPEnabled = false
    
    -- Clear all ESP objects
    for _, obj in pairs(ESPObjects) do
        if obj and obj.Parent then
            obj:Destroy()
        end
    end
    for _, obj in pairs(BoxESPObjects) do
        if obj and obj.Parent then
            obj:Destroy()
        end
    end
    for _, obj in pairs(TracerObjects) do
        if obj and obj.Parent then
            obj:Destroy()
        end
    end
    for _, obj in pairs(HealthBarObjects) do
        if obj and obj.Parent then
            obj:Destroy()
        end
    end
    for _, obj in pairs(ChamObjects) do
        if obj and obj.Parent then
            obj:Destroy()
        end
    end
    
    ESPObjects = {}
    BoxESPObjects = {}
    TracerObjects = {}
    HealthBarObjects = {}
    ChamObjects = {}
    
    -- Disconnect all ESP connections
    for _, conn in pairs(ESPConnections) do
        if conn then
            conn:Disconnect()
        end
    end
    ESPConnections = {}
end

-- IMPROVED ESP CREATION FUNCTIONS
function CreateNameESP(character, player)
    if not ESPEnabled then return end
    
    local head = character:WaitForChild("Head", 2)
    if not head then return end
    
    local billboard = Instance.new("BillboardGui")
    billboard.Name = "NameESP_" .. player.Name
    billboard.Size = UDim2.new(0, 200, 0, 50)
    billboard.StudsOffset = Vector3.new(0, 3, 0)
    billboard.AlwaysOnTop = true
    billboard.Adornee = head
    billboard.Parent = head
    
    local espText = Instance.new("TextLabel")
    espText.Size = UDim2.new(1, 0, 1, 0)
    espText.BackgroundTransparency = 1
    espText.Text = player.DisplayName .. " [" .. player.Name .. "] ~ 0m"
    espText.TextColor3 = THEME.Primary
    espText.TextSize = 14
    espText.Font = Enum.Font.GothamBold
    espText.TextStrokeTransparency = 0.5
    espText.Parent = billboard
    
    table.insert(ESPObjects, billboard)
    
    -- Distance update
    coroutine.wrap(function()
        while ESPEnabled and billboard and billboard.Parent do
            if LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then
                local distance = (head.Position - LocalPlayer.Character.HumanoidRootPart.Position).Magnitude
                espText.Text = player.DisplayName .. " [" .. player.Name .. "] ~ " .. math.floor(distance) .. "m"
            end
            wait(0.1)
        end
    end)()
end

function CreateBoxESP(character, player)
    if not ESPEnabled then return end
    
    local humanoidRootPart = character:WaitForChild("HumanoidRootPart", 2)
    if not humanoidRootPart then return end
    
    local box = Instance.new("BoxHandleAdornment")
    box.Name = "BoxESP_" .. player.Name
    box.Size = Vector3.new(4, 6, 1)
    box.Color3 = THEME.Primary
    box.Transparency = 0.7
    box.AlwaysOnTop = true
    box.Adornee = humanoidRootPart
    box.ZIndex = 1
    box.Parent = humanoidRootPart
    
    table.insert(BoxESPObjects, box)
end

function CreateTracer(character, player)
    if not ESPEnabled then return end
    
    local humanoidRootPart = character:WaitForChild("HumanoidRootPart", 2)
    if not humanoidRootPart then return end
    
    local tracer = Drawing.new("Line")
    tracer.Visible = false
    tracer.Color = THEME.Primary
    tracer.Thickness = 1
    tracer.Transparency = 0.7
    
    table.insert(TracerObjects, tracer)
    
    coroutine.wrap(function()
        while ESPEnabled and tracer do
            if humanoidRootPart and humanoidRootPart.Parent and LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then
                local localRoot = LocalPlayer.Character.HumanoidRootPart
                local screenPoint, onScreen = Camera:WorldToViewportPoint(humanoidRootPart.Position)
                local localScreenPoint = Camera:WorldToViewportPoint(localRoot.Position)
                
                if onScreen then
                    tracer.From = Vector2.new(localScreenPoint.X, localScreenPoint.Y)
                    tracer.To = Vector2.new(screenPoint.X, screenPoint.Y)
                    tracer.Visible = true
                else
                    tracer.Visible = false
                end
            else
                tracer.Visible = false
            end
            wait()
        end
        
        if tracer then
            tracer:Remove()
        end
    end)()
end

function CreateHealthBar(character, player)
    if not ESPEnabled then return end
    
    local head = character:WaitForChild("Head", 2)
    local humanoid = character:WaitForChild("Humanoid", 2)
    if not head or not humanoid then return end
    
    local healthBar = Instance.new("BillboardGui")
    healthBar.Name = "HealthBar_" .. player.Name
    healthBar.Size = UDim2.new(2, 0, 0.2, 0)
    healthBar.StudsOffset = Vector3.new(0, 3.5, 0)
    healthBar.AlwaysOnTop = true
    healthBar.Adornee = head
    healthBar.Parent = head
    
    local background = Instance.new("Frame")
    background.Size = UDim2.new(1, 0, 1, 0)
    background.BackgroundColor3 = Color3.new(0, 0, 0)
    background.BorderSizePixel = 1
    background.BorderColor3 = Color3.new(1, 1, 1)
    background.Parent = healthBar
    
    local healthFill = Instance.new("Frame")
    healthFill.Size = UDim2.new(humanoid.Health / humanoid.MaxHealth, 0, 1, 0)
    healthFill.BackgroundColor3 = Color3.new(0, 1, 0)
    healthFill.BorderSizePixel = 0
    healthFill.Parent = background
    
    table.insert(HealthBarObjects, healthBar)
    
    -- Health update connection
    local healthConnection
    healthConnection = humanoid.HealthChanged:Connect(function()
        if healthFill and healthFill.Parent then
            healthFill.Size = UDim2.new(humanoid.Health / humanoid.MaxHealth, 0, 1, 0)
            healthFill.BackgroundColor3 = Color3.new(1 - humanoid.Health / humanoid.MaxHealth, humanoid.Health / humanoid.MaxHealth, 0)
        else
            healthConnection:Disconnect()
        end
    end)
end

function CreateChams(character, player)
    if not ESPEnabled then return end
    
    for _, part in pairs(character:GetDescendants()) do
        if part:IsA("BasePart") and part.Transparency < 1 then
            local highlight = Instance.new("Highlight")
            highlight.Name = "Cham_" .. player.Name
            highlight.FillColor = THEME.Primary
            highlight.FillTransparency = 0.7
            highlight.OutlineColor = THEME.Secondary
            highlight.OutlineTransparency = 0
            highlight.Adornee = part
            highlight.Parent = part
            
            table.insert(ChamObjects, highlight)
        end
    end
end

-- ANTI-FLING SYSTEM
function EnableAntiFling()
    if AntiFlingConnection then
        AntiFlingConnection:Disconnect()
    end
    
    AntiFlingConnection = RunService.Heartbeat:Connect(function()
        if not Modules.Utility.AntiFling or not LocalPlayer.Character then
            return
        end
        
        local root = LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
        if not root then return end
        
        -- Detect high velocity (fling detection)
        local velocity = root.Velocity
        local speed = velocity.Magnitude
        
        -- If velocity is too high, counter it
        if speed > 100 then
            -- Apply opposite force to counter fling
            local antiVelocity = -velocity.Unit * math.min(speed, 150)
            
            -- Create anti-velocity force
            local bodyVelocity = root:FindFirstChild("AntiFlingVelocity") or Instance.new("BodyVelocity")
            bodyVelocity.Name = "AntiFlingVelocity"
            bodyVelocity.Velocity = antiVelocity
            bodyVelocity.MaxForce = Vector3.new(40000, 40000, 40000)
            bodyVelocity.P = 1250
            bodyVelocity.Parent = root
            
            -- Also anchor the character briefly
            root.Anchored = true
            wait(0.05)
            if root then
                root.Anchored = false
            end
        else
            -- Remove anti-velocity when not needed
            local bodyVelocity = root:FindFirstChild("AntiFlingVelocity")
            if bodyVelocity then
                bodyVelocity:Destroy()
            end
        end
    end)
end

function DisableAntiFling()
    if AntiFlingConnection then
        AntiFlingConnection:Disconnect()
        AntiFlingConnection = nil
    end
    
    -- Clean up anti-fling objects
    if LocalPlayer.Character then
        local root = LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
        if root then
            root.Anchored = false
            local bodyVelocity = root:FindFirstChild("AntiFlingVelocity")
            if bodyVelocity then
                bodyVelocity:Destroy()
            end
        end
    end
end

-- ADVANCED SPIN BOT SYSTEM
local SpinBotConnection

function EnableSpinBot()
    if SpinBotConnection then
        SpinBotConnection:Disconnect()
    end
    
    SpinBotConnection = RunService.Heartbeat:Connect(function()
        if not Modules.Fun.SpinBot or not LocalPlayer.Character then
            return
        end
        
        local root = LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
        if not root then return end
        
        local settings = Modules.Fun.SpinBotSettings
        local rotation = CFrame.new()
        
        -- Calculate rotation based on enabled axes
        if settings.Yaw then
            local yawRotation = CFrame.Angles(0, math.rad(settings.YawSpeed * settings.Speed * settings.Direction), 0)
            rotation = rotation * yawRotation
        end
        
        if settings.Pitch then
            local pitchRotation = CFrame.Angles(math.rad(settings.PitchSpeed * settings.Speed * settings.Direction), 0, 0)
            rotation = rotation * pitchRotation
        end
        
        if settings.Roll then
            local rollRotation = CFrame.Angles(0, 0, math.rad(settings.RollSpeed * settings.Speed * settings.Direction))
            rotation = rotation * rollRotation
        end
        
        -- Apply randomization if enabled
        if settings.Randomize then
            local randomFactor = math.random(80, 120) / 100
            rotation = rotation * CFrame.Angles(
                math.rad(math.random(-5, 5)),
                math.rad(math.random(-5, 5)), 
                math.rad(math.random(-5, 5))
            )
        end
        
        root.CFrame = root.CFrame * rotation
    end)
end

function DisableSpinBot()
    if SpinBotConnection then
        SpinBotConnection:Disconnect()
        SpinBotConnection = nil
    end
end

-- IMPROVED DESYNC SYSTEM WITH PHANTOM CHARACTER
function CreatePhantomCharacter(position)
    if PhantomCharacter then
        PhantomCharacter:Destroy()
    end
    
    local phantom = Instance.new("Model")
    phantom.Name = "PhantomCharacter"
    
    -- Create invisible parts for phantom
    local head = Instance.new("Part")
    head.Name = "Head"
    head.Size = Vector3.new(2, 1, 1)
    head.Transparency = 1
    head.CanCollide = false
    head.Anchored = true
    head.Position = position + Vector3.new(0, 1.5, 0)
    head.Parent = phantom
    
    local torso = Instance.new("Part")
    torso.Name = "Torso"
    torso.Size = Vector3.new(2, 2, 1)
    torso.Transparency = 1
    torso.CanCollide = false
    torso.Anchored = true
    torso.Position = position
    torso.Parent = phantom
    
    local humanoid = Instance.new("Humanoid")
    humanoid.Parent = phantom
    
    phantom.PrimaryPart = torso
    phantom.Parent = workspace
    
    return phantom
end

function EnableDesync()
    if DesyncConnection then
        DesyncConnection:Disconnect()
    end
    
    local character = LocalPlayer.Character
    if not character then return end
    
    local root = character:FindFirstChild("HumanoidRootPart")
    if not root then return end
    
    OriginalPosition = root.Position
    
    -- Create phantom character at camera position
    PhantomCharacter = CreatePhantomCharacter(Camera.CFrame.Position)
    
    -- Store original camera subject
    local originalCameraSubject = Camera.CameraSubject
    
    -- Switch camera to phantom
    Camera.CameraSubject = PhantomCharacter.Humanoid
    
    local settings = Modules.Fun.DesyncSettings
    
    DesyncConnection = RunService.Heartbeat:Connect(function()
        if not Modules.Fun.Desync or not character or not root then
            return
        end
        
        -- Calculate random position within radius including height
        local radius = math.random(settings.MinRadius, settings.MaxRadius)
        local angle = math.random() * 2 * math.pi
        local height = math.random(-settings.Height, settings.Height)
        
        local offset = Vector3.new(
            math.cos(angle) * radius,
            height,
            math.sin(angle) * radius
        )
        
        -- Teleport real character
        root.CFrame = CFrame.new(OriginalPosition + offset)
        
        -- Update phantom position to stay at camera position
        if PhantomCharacter and PhantomCharacter.PrimaryPart then
            PhantomCharacter:SetPrimaryPartCFrame(CFrame.new(Camera.CFrame.Position))
        end
        
        -- Auto return if enabled
        if settings.TeleportBack then
            wait(0.1)
            if Modules.Fun.Desync then
                root.CFrame = CFrame.new(OriginalPosition)
            end
        end
    end)
end

function DisableDesync()
    if DesyncConnection then
        DesyncConnection:Disconnect()
        DesyncConnection = nil
    end
    
    -- Return to original position
    if LocalPlayer.Character then
        local root = LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
        if root and OriginalPosition then
            root.CFrame = CFrame.new(OriginalPosition)
        end
    end
    
    -- Remove phantom and restore camera
    if PhantomCharacter then
        PhantomCharacter:Destroy()
        PhantomCharacter = nil
    end
    
    -- Restore original camera subject
    if LocalPlayer.Character and LocalPlayer.Character:FindFirstChildOfClass("Humanoid") then
        Camera.CameraSubject = LocalPlayer.Character.Humanoid
    end
end

-- Other essential systems (Fly, Noclip, etc.)
local flyConnection
local bodyGyro, bodyVelocity

function EnableFly()
    local character = LocalPlayer.Character
    if not character or not character:FindFirstChild("HumanoidRootPart") then return end
    
    local root = character.HumanoidRootPart
    
    bodyGyro = Instance.new("BodyGyro")
    bodyGyro.P = 10000
    bodyGyro.D = 1000
    bodyGyro.MaxTorque = Vector3.new(40000, 40000, 40000)
    bodyGyro.CFrame = root.CFrame
    bodyGyro.Parent = root
    
    bodyVelocity = Instance.new("BodyVelocity")
    bodyVelocity.Velocity = Vector3.new(0, 0, 0)
    bodyVelocity.MaxForce = Vector3.new(40000, 40000, 40000)
    bodyVelocity.Parent = root
    
    character.Humanoid.PlatformStand = true
    
    flyConnection = RunService.Heartbeat:Connect(function()
        if not Modules.Movement.Fly or not character or not root then
            return
        end
        
        local moveDirection = Vector3.new(0, 0, 0)
        
        if UserInputService:IsKeyDown(Enum.KeyCode.W) then
            moveDirection = moveDirection + Camera.CFrame.LookVector
        end
        if UserInputService:IsKeyDown(Enum.KeyCode.S) then
            moveDirection = moveDirection - Camera.CFrame.LookVector
        end
        if UserInputService:IsKeyDown(Enum.KeyCode.A) then
            moveDirection = moveDirection - Camera.CFrame.RightVector
        end
        if UserInputService:IsKeyDown(Enum.KeyCode.D) then
            moveDirection = moveDirection + Camera.CFrame.RightVector
        end
        if UserInputService:IsKeyDown(Enum.KeyCode.Space) then
            moveDirection = moveDirection + Vector3.new(0, 1, 0)
        end
        if UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) then
            moveDirection = moveDirection - Vector3.new(0, 1, 0)
        end
        
        if moveDirection.Magnitude > 0 then
            moveDirection = moveDirection.Unit * Modules.Movement.FlySpeed
        end
        
        bodyVelocity.Velocity = moveDirection
        bodyGyro.CFrame = CFrame.new(root.Position, root.Position + Camera.CFrame.LookVector)
    end)
end

function DisableFly()
    if flyConnection then
        flyConnection:Disconnect()
        flyConnection = nil
    end
    
    local character = LocalPlayer.Character
    if character then
        character.Humanoid.PlatformStand = false
        
        if bodyGyro then
            bodyGyro:Destroy()
            bodyGyro = nil
        end
        
        if bodyVelocity then
            bodyVelocity:Destroy()
            bodyVelocity = nil
        end
    end
end

function EnableNoclip()
    spawn(function()
        while Modules.Movement.Noclip and LocalPlayer.Character do
            for _, part in pairs(LocalPlayer.Character:GetDescendants()) do
                if part:IsA("BasePart") then
                    part.CanCollide = false
                end
            end
            wait(0.1)
        end
    end)
end

function DisableNoclip()
    if LocalPlayer.Character then
        for _, part in pairs(LocalPlayer.Character:GetDescendants()) do
            if part:IsA("BasePart") then
                part.CanCollide = true
            end
        end
    end
end

function EnableXRay()
    for _, part in pairs(workspace:GetDescendants()) do
        if part:IsA("BasePart") and part.Transparency < 1 then
            part.LocalTransparencyModifier = 0.5
        end
    end
end

function DisableXRay()
    for _, part in pairs(workspace:GetDescendants()) do
        if part:IsA("BasePart") then
            part.LocalTransparencyModifier = 0
        end
    end
end

function EnableNightVision()
    Lighting.Ambient = Color3.new(1, 1, 1)
    Lighting.Brightness = 2
    Lighting.OutdoorAmbient = Color3.new(1, 1, 1)
end

function DisableNightVision()
    Lighting.Ambient = Color3.new(0.5, 0.5, 0.5)
    Lighting.Brightness = 1
    Lighting.OutdoorAmbient = Color3.new(0.5, 0.5, 0.5)
end

function EnableFullbright()
    Lighting.GlobalShadows = false
end

function DisableFullbright()
    Lighting.GlobalShadows = true
end

function EnableChatSpam()
    spawn(function()
        while Modules.Utility.ChatSpam do
            local success = pcall(function()
                game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer("rasvet-hub V2.0 User!", "All")
            end)
            wait(3)
        end
    end)
end

function EnableAutoClicker()
    spawn(function()
        while Modules.Utility.AutoClicker do
            mouse1click()
            wait(1/Modules.Utility.ClickSpeed)
        end
    end)
end

-- Infinite Jump
UserInputService.JumpRequest:Connect(function()
    if Modules.Movement.InfiniteJump and LocalPlayer.Character then
        local humanoid = LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
        if humanoid then
            humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
        end
    end
end)

-- Anti-AFK
if Modules.Utility.AntiAFK then
    game:GetService("Players").LocalPlayer.Idled:Connect(function()
        game:GetService("VirtualUser"):Button2Down(Vector2.new(0,0),workspace.CurrentCamera.CFrame)
        wait(1)
        game:GetService("VirtualUser"):Button2Up(Vector2.new(0,0),workspace.CurrentCamera.CFrame)
    end)
end

-- UI Interactions
CloseButton.MouseButton1Click:Connect(function()
    MainUI:Destroy()
end)

-- Drag System
local dragging = false
local dragStart, startPos

Header.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        dragging = true
        dragStart = input.Position
        startPos = MainContainer.Position
    end
end)

Header.InputEnded:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        dragging = false
    end
end)

UserInputService.InputChanged:Connect(function(input)
    if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
        local delta = input.Position - dragStart
        MainContainer.Position = UDim2.new(
            startPos.X.Scale, 
            startPos.X.Offset + delta.X,
            startPos.Y.Scale, 
            startPos.Y.Offset + delta.Y
        )
    end
end)

-- Mobile Support
if UserInputService.TouchEnabled then
    MainContainer.Size = UDim2.new(0, 380, 0, 550)
    MainContainer.Position = UDim2.new(0.5, -190, 0.5, -275)
end

print("🎯 rasvet-hub V2.0 Loaded Successfully!")
print("🟢 Status: Online")
print("🔧 Fixed: Player ESP now working properly")
print("🛡️ Added: Anti-Fling protection system")
print("📊 ESP Format: NickName [OriginalName] ~ distance")
print("⚡ All systems operational")