Auto revive
Key Required

Auto revive

Froggeaboramz607aboramz607 167 views 0 executesUpdated Oct 18, 2026
Unrated
00
Lua Script•2353 lines (86591 chars)
--[[
    ╔══════════════════════════════════════╗
    ║        🐸 مركز الضفدع v19.3          ║
    ║ 🛡️ هروب: 10م (الضفدع لازم يقرّب     ║
    ║    جداً عشان يهرب بك)               ║
    ║ 🚶 انتقال واقف (بلا دمج)             ║
    ╚══════════════════════════════════════╝
]]

--═════════ الخدمات ═════════--
local Players             = game:GetService("Players")
local LocalPlayer         = Players.LocalPlayer
local UserInputService    = game:GetService("UserInputService")
local RunService          = game:GetService("RunService")
local StarterGui          = game:GetService("StarterGui")
local TweenService        = game:GetService("TweenService")
local Lighting            = game:GetService("Lighting")
local Workspace           = game:GetService("Workspace")
local VirtualUser         = game:GetService("VirtualUser")
local VirtualInputManager = game:GetService("VirtualInputManager")
local HttpService         = game:GetService("HttpService")

print("═════════════════════════════════")
print("🐸 مركز الضفدع v19.3 - بدأ التحميل...")
print("═════════════════════════════════")

--═════════ 🔐 كلمة السر ═════════--
local PASSWORD_HASH = {
    114, 111, 109, 97, 108, 32, 43, 114, 97, 114, 109, 122, 101, 32, 111, 110, 116, 111, 112
}

local function GetRealPassword()
    local s = ""
    for _, c in ipairs(PASSWORD_HASH) do
        s = s .. string.char(c)
    end
    return s
end

local function NormalizePassword(s)
    s = tostring(s or "")
    s = s:lower()
    s = s:gsub("%c", "")
    s = s:gsub("\194\160", "")
    s = s:gsub("\226\128\139", "")
    s = s:gsub("\226\128\140", "")
    s = s:gsub("\226\128\141", "")
    s = s:gsub("\226\128\142", "")
    s = s:gsub("\226\128\143", "")
    s = s:gsub("\239\187\191", "")
    s = s:gsub("%s+", " ")
    s = s:gsub("^ ", "")
    s = s:gsub(" $", "")
    return s
end

local StartMainScript

--═════════ شاشة القفل ═════════--
local LockGui = Instance.new("ScreenGui")
LockGui.Name = "FroggeLock_"..tostring(math.random(1000, 9999))
LockGui.ResetOnSpawn = false
LockGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
LockGui.DisplayOrder = 2000

do
    local ok = pcall(function()
        local target = (gethui and gethui()) or game:GetService("CoreGui")
        LockGui.Parent = target
    end)
    if not ok or LockGui.Parent == nil then
        LockGui.Parent = LocalPlayer:WaitForChild("PlayerGui")
    end
end

local LockBackground = Instance.new("Frame")
LockBackground.Size = UDim2.new(1, 0, 1, 0)
LockBackground.BackgroundColor3 = Color3.fromRGB(10, 10, 16)
LockBackground.BackgroundTransparency = 0.25
LockBackground.BorderSizePixel = 0
LockBackground.Parent = LockGui

local LockBox = Instance.new("Frame")
LockBox.Size = UDim2.new(0, 340, 0, 300)
LockBox.Position = UDim2.new(0.5, -170, 0.22, 0)
LockBox.BackgroundColor3 = Color3.fromRGB(18, 18, 26)
LockBox.BorderSizePixel = 0
LockBox.Parent = LockBackground

local LockCorner = Instance.new("UICorner")
LockCorner.CornerRadius = UDim.new(0, 16)
LockCorner.Parent = LockBox

local LockStroke = Instance.new("UIStroke")
LockStroke.Color = Color3.fromRGB(60, 160, 90)
LockStroke.Thickness = 2
LockStroke.Parent = LockBox

local LockIcon = Instance.new("TextLabel")
LockIcon.Size = UDim2.new(1, 0, 0, 46)
LockIcon.Position = UDim2.new(0, 0, 0, 10)
LockIcon.BackgroundTransparency = 1
LockIcon.Text = "🔐"
LockIcon.TextSize = 40
LockIcon.Font = Enum.Font.GothamBlack
LockIcon.Parent = LockBox

local LockTitle = Instance.new("TextLabel")
LockTitle.Size = UDim2.new(1, 0, 0, 26)
LockTitle.Position = UDim2.new(0, 0, 0, 58)
LockTitle.BackgroundTransparency = 1
LockTitle.Text = "مركز الضفدع - محمي"
LockTitle.TextColor3 = Color3.fromRGB(85, 220, 130)
LockTitle.TextSize = 19
LockTitle.Font = Enum.Font.GothamBlack
LockTitle.Parent = LockBox

local LockDesc = Instance.new("TextLabel")
LockDesc.Size = UDim2.new(1, -30, 0, 18)
LockDesc.Position = UDim2.new(0, 15, 0, 86)
LockDesc.BackgroundTransparency = 1
LockDesc.Text = "اكتب كلمة السر (بالكيبورد الإنجليزي!)"
LockDesc.TextColor3 = Color3.fromRGB(140, 140, 155)
LockDesc.TextSize = 12
LockDesc.Font = Enum.Font.Gotham
LockDesc.Parent = LockBox

local PasswordBox = Instance.new("TextBox")
PasswordBox.Size = UDim2.new(1, -60, 0, 48)
PasswordBox.Position = UDim2.new(0, 30, 0, 112)
PasswordBox.BackgroundColor3 = Color3.fromRGB(30, 30, 42)
PasswordBox.BorderSizePixel = 0
PasswordBox.Text = ""
PasswordBox.PlaceholderText = "كلمة السر هنا..."
PasswordBox.PlaceholderColor3 = Color3.fromRGB(100, 100, 115)
PasswordBox.TextColor3 = Color3.fromRGB(230, 230, 235)
PasswordBox.TextSize = 17
PasswordBox.Font = Enum.Font.GothamBold
PasswordBox.ClearTextOnFocus = false
PasswordBox.Parent = LockBox

local PwCorner = Instance.new("UICorner")
PwCorner.CornerRadius = UDim.new(0, 10)
PwCorner.Parent = PasswordBox

local SubmitBtn = Instance.new("TextButton")
SubmitBtn.Size = UDim2.new(1, -60, 0, 48)
SubmitBtn.Position = UDim2.new(0, 30, 0, 170)
SubmitBtn.BackgroundColor3 = Color3.fromRGB(38, 122, 72)
SubmitBtn.BorderSizePixel = 0
SubmitBtn.Text = "🔓 فتح"
SubmitBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
SubmitBtn.TextSize = 18
SubmitBtn.Font = Enum.Font.GothamBlack
SubmitBtn.Parent = LockBox

local SubmitCorner = Instance.new("UICorner")
SubmitCorner.CornerRadius = UDim.new(0, 10)
SubmitCorner.Parent = SubmitBtn

local StatusMsg = Instance.new("TextLabel")
StatusMsg.Size = UDim2.new(1, -20, 0, 40)
StatusMsg.Position = UDim2.new(0, 10, 0, 226)
StatusMsg.BackgroundTransparency = 1
StatusMsg.Text = ""
StatusMsg.TextColor3 = Color3.fromRGB(255, 100, 100)
StatusMsg.TextSize = 12
StatusMsg.TextWrapped = true
StatusMsg.Font = Enum.Font.GothamBold
StatusMsg.Parent = LockBox

local AccessGranted = false

local function ShakeBox()
    local originalPos = LockBox.Position
    LockStroke.Color = Color3.fromRGB(220, 60, 60)
    TweenService:Create(LockBox, TweenInfo.new(0.05), {Position = originalPos + UDim2.new(0, 8, 0, 0)}):Play()
    task.wait(0.05)
    TweenService:Create(LockBox, TweenInfo.new(0.05), {Position = originalPos + UDim2.new(0, -8, 0, 0)}):Play()
    task.wait(0.05)
    TweenService:Create(LockBox, TweenInfo.new(0.05), {Position = originalPos + UDim2.new(0, 5, 0, 0)}):Play()
    task.wait(0.05)
    TweenService:Create(LockBox, TweenInfo.new(0.05), {Position = originalPos}):Play()
    task.delay(1, function()
        if not AccessGranted then
            LockStroke.Color = Color3.fromRGB(60, 160, 90)
        end
    end)
end

local function TryUnlock()
    if AccessGranted then return end
    local entered = NormalizePassword(PasswordBox.Text)
    local correct = NormalizePassword(GetRealPassword())

    if entered == correct then
        AccessGranted = true
        print("[✅] كلمة السر صحيحة! جارٍ تشغيل السكريبت...")
        StatusMsg.Text = "✅ صحيح - جارٍ التشغيل..."
        StatusMsg.TextColor3 = Color3.fromRGB(85, 255, 127)
        LockStroke.Color = Color3.fromRGB(85, 255, 127)
        PasswordBox.Text = ""

        task.wait(0.6)
        LockGui:Destroy()

        local ok, err = pcall(StartMainScript)
        if not ok then
            print("❌ خطأ داخل السكريبت: "..tostring(err))
        end
    else
        local codes = {}
        for i = 1, math.min(#entered, 30) do
            codes[#codes + 1] = string.byte(entered, i)
        end
        print("[❌] كلمة خاطئة • طولك: "..#entered.." • المطلوب: "..#correct)
        if #entered > 0 then
            print("[❌] أكواد مدخلك: "..table.concat(codes, ","))
        else
            print("[❌] الحقل فاضي - اكتب شي!")
        end
        StatusMsg.Text = "❌ خاطئة • تأكد أن الكيبورد إنجليزي وحاول ثانية"
        StatusMsg.TextColor3 = Color3.fromRGB(255, 100, 100)
        ShakeBox()
    end
end

SubmitBtn.MouseButton1Click:Connect(function()
    task.spawn(TryUnlock)
end)

PasswordBox.FocusLost:Connect(function(enterPressed)
    if enterPressed then
        task.spawn(TryUnlock)
    end
end)

task.delay(0.5, function()
    pcall(function()
        PasswordBox:CaptureFocus()
    end)
end)

print("[🔐] شاشة القفل جاهزة - اكتب كلمة السر...")

--═════════════════════════════════════════
--═════════ 🚀 السكريبت الرئيسي ═════════--
--═════════════════════════════════════════
StartMainScript = function()

local REVIVE_KEY    = Enum.KeyCode.E
local E_HOLD_MAX    = 8
local SpeedValue    = 35
local FlySpeed      = 50

-- ⚡ v19.3: الهروب 10م والتنبيه 20م
local DANGER_RADIUS   = 10
local GUARD_RADIUS    = 8
local ESCAPE_COOLDOWN = 1.0
local WARN_RADIUS     = 20

local HELPER_RADIUS   = 15
local HELPER_FRESH    = 5

local NotifyLevel = "all"

local Stats = {
    escapes = 0,
    rescues = 0,
    reviveSuccess = 0,
    warnings = 0,
}

local States = {
    AutoTP = true, AutoRevive = true, Speed = false, InfJump = false,
    Fly = false, ESP = false, AntiAFK = false, Fullbright = false,
    Noclip = false, SelfEscape = true, Underground = false,
}

local FrogPlayer = nil
local FrogSelectBtn = nil
local followActive, followTarget, followConn, followManual = false, nil, nil, false
local IsReviving = false

--═════════ 📢 الإشعارات ═════════--
local function NotifyMsg(msgType, title, text, duration)
    if NotifyLevel == "off" then return end
    if NotifyLevel == "important" and msgType == "info" then return end
    task.spawn(function()
        for _ = 1, 3 do
            local ok = pcall(function()
                StarterGui:SetCore("SendNotification", {
                    Title = title, Text = text, Duration = duration or 3,
                })
            end)
            if ok then break end
            task.wait(1)
        end
    end)
    print("[🐸 "..title.."] "..text)
end

local function Notify(title, text, duration)
    NotifyMsg("info", title, text, duration)
end

local function FormatDistance(studs)
    return math.floor(studs).." متراً"
end

local function GetPlayersDistance(plr1, plr2)
    local r1 = plr1.Character and plr1.Character:FindFirstChild("HumanoidRootPart")
    local r2 = plr2.Character and plr2.Character:FindFirstChild("HumanoidRootPart")
    if r1 and r2 then
        return (r1.Position - r2.Position).Magnitude
    end
    return nil
end

--═════════ ⭐ نظام المستويات ═════════--
local MyLevel = 1
local MyHelps = 0
local ShowMyBadge = true
local ShowOthersBadge = true
local LevelData = {}
local creditedByMe = {}
local downedHelpers = {}
local maxLevelNotified = false

local LEVEL_FILE = "FroggeHub/level_"..LocalPlayer.UserId..".json"

local function GetLevelTarget(level)
    return level * 10
end

local function GetOrCreateLevelData(plr)
    if not LevelData[plr] then
        LevelData[plr] = {level = 1, helps = 0}
    end
    return LevelData[plr]
end

local function SaveMyLevel()
    pcall(function()
        if writefile and isfolder and makefolder then
            if not isfolder("FroggeHub") then
                makefolder("FroggeHub")
            end
            writefile(LEVEL_FILE, HttpService:JSONEncode({
                level = MyLevel, helps = MyHelps,
            }))
        end
    end)
end

pcall(function()
    if readfile and isfile and isfile(LEVEL_FILE) then
        local data = HttpService:JSONDecode(readfile(LEVEL_FILE))
        if data.level then
            MyLevel = math.clamp(math.floor(data.level), 1, 999)
        end
        if data.helps then
            MyHelps = math.max(0, math.floor(data.helps))
        end
        print("[FroggeHub] ⭐ حسابك: Lv "..MyLevel.." • "..MyHelps.."/"..GetLevelTarget(MyLevel))
    end
end)

--═════════ الواجهة ═════════--
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "FroggeHub_"..tostring(math.random(1000, 9999))
ScreenGui.ResetOnSpawn = false
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
ScreenGui.DisplayOrder = 999

do
    local ok = pcall(function()
        local target = (gethui and gethui()) or game:GetService("CoreGui")
        ScreenGui.Parent = target
    end)
    if not ok or ScreenGui.Parent == nil then
        ScreenGui.Parent = LocalPlayer:WaitForChild("PlayerGui")
    end
    for _, child in pairs(ScreenGui.Parent:GetChildren()) do
        if child ~= ScreenGui and child:IsA("ScreenGui") and string.sub(child.Name, 1, 10) == "FroggeHub_" then
            child:Destroy()
        end
    end
end

do
    for _, plr in ipairs(Players:GetPlayers()) do
        if plr.Character then
            for _, d in ipairs(plr.Character:GetDescendants()) do
                if d.Name == "FroggeHub_LevelBadge" then
                    d:Destroy()
                end
            end
        end
    end
end

local MainFrame = Instance.new("Frame")
MainFrame.Size = UDim2.new(0, 310, 0, 450)
MainFrame.Position = UDim2.new(0.5, -155, 0.5, -225)
MainFrame.BackgroundColor3 = Color3.fromRGB(18, 18, 26)
MainFrame.BorderSizePixel = 0
MainFrame.ClipsDescendants = true
MainFrame.Parent = ScreenGui

local MainCorner = Instance.new("UICorner") MainCorner.CornerRadius = UDim.new(0, 14) MainCorner.Parent = MainFrame
local MainStroke = Instance.new("UIStroke") MainStroke.Color = Color3.fromRGB(60, 160, 90) MainStroke.Thickness = 1.5 MainStroke.Transparency = 0.3 MainStroke.Parent = MainFrame

local TitleBar = Instance.new("Frame")
TitleBar.Size = UDim2.new(1, 0, 0, 52)
TitleBar.BackgroundColor3 = Color3.fromRGB(24, 24, 36)
TitleBar.BorderSizePixel = 0
TitleBar.Parent = MainFrame

local TitleCorner = Instance.new("UICorner") TitleCorner.CornerRadius = UDim.new(0, 14) TitleCorner.Parent = TitleBar
local TitleFix = Instance.new("Frame")
TitleFix.Size = UDim2.new(1, 0, 0, 14)
TitleFix.Position = UDim2.new(0, 0, 1, -14)
TitleFix.BackgroundColor3 = Color3.fromRGB(24, 24, 36)
TitleFix.BorderSizePixel = 0
TitleFix.Parent = TitleBar

local TitleLabel = Instance.new("TextLabel")
TitleLabel.Size = UDim2.new(1, -80, 0, 30)
TitleLabel.Position = UDim2.new(0, 14, 0, 5)
TitleLabel.BackgroundTransparency = 1
TitleLabel.Text = "🐸 مركز الضفدع v19.3"
TitleLabel.TextColor3 = Color3.fromRGB(85, 220, 130)
TitleLabel.TextSize = 18
TitleLabel.Font = Enum.Font.GothamBlack
TitleLabel.TextXAlignment = Enum.TextXAlignment.Left
TitleLabel.Parent = TitleBar

local SubLabel = Instance.new("TextLabel")
SubLabel.Size = UDim2.new(1, -80, 0, 16)
SubLabel.Position = UDim2.new(0, 14, 0, 34)
SubLabel.BackgroundTransparency = 1
SubLabel.Text = "🛡️ هروب 10م • "..LocalPlayer.Name
SubLabel.TextColor3 = Color3.fromRGB(110, 110, 130)
SubLabel.TextSize = 11
SubLabel.Font = Enum.Font.Gotham
SubLabel.TextXAlignment = Enum.TextXAlignment.Left
SubLabel.Parent = TitleBar

local MinimizeButton = Instance.new("TextButton")
MinimizeButton.Size = UDim2.new(0, 34, 0, 34)
MinimizeButton.Position = UDim2.new(1, -40, 0, 9)
MinimizeButton.BackgroundColor3 = Color3.fromRGB(40, 40, 56)
MinimizeButton.BorderSizePixel = 0
MinimizeButton.Text = "—"
MinimizeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
MinimizeButton.TextSize = 18
MinimizeButton.Font = Enum.Font.GothamBold
MinimizeButton.Parent = TitleBar
local MinCorner = Instance.new("UICorner") MinCorner.CornerRadius = UDim.new(0, 8) MinCorner.Parent = MinimizeButton

local Content = Instance.new("ScrollingFrame")
Content.Size = UDim2.new(1, -6, 1, -62)
Content.Position = UDim2.new(0, 3, 0, 56)
Content.BackgroundTransparency = 1
Content.BorderSizePixel = 0
Content.ScrollBarThickness = 5
Content.ScrollBarImageColor3 = Color3.fromRGB(85, 220, 130)
Content.CanvasSize = UDim2.new(0, 0, 0, 900)
Content.Parent = MainFrame

local UIList = Instance.new("UIListLayout")
UIList.SortOrder = Enum.SortOrder.LayoutOrder
UIList.Padding = UDim.new(0, 6)
UIList.Parent = Content

UIList:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
    Content.CanvasSize = UDim2.new(0, 0, 0, UIList.AbsoluteContentSize.Y + 20)
end)

local StatusLabel = Instance.new("TextLabel")
StatusLabel.Size = UDim2.new(1, -20, 0, 22)
StatusLabel.Position = UDim2.new(0, 10, 1, -27)
StatusLabel.BackgroundTransparency = 1
StatusLabel.Text = "👀 أراقب - جاهز للإنقاذ!"
StatusLabel.TextColor3 = Color3.fromRGB(85, 220, 130)
StatusLabel.TextSize = 12
StatusLabel.Font = Enum.Font.Gotham
StatusLabel.TextXAlignment = Enum.TextXAlignment.Left
StatusLabel.Parent = MainFrame

--═════════ سحب القائمة ═════════--
do
    local dragging, dragStart, startPosition = false, nil, nil
    TitleBar.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1
        or input.UserInputType == Enum.UserInputType.Touch then
            dragging = true
            dragStart = input.Position
            startPosition = MainFrame.Position
            input.Changed:Connect(function()
                if input.UserInputState == Enum.UserInputState.End then
                    dragging = false
                end
            end)
        end
    end)
    UserInputService.InputChanged:Connect(function(input)
        if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement
        or input.UserInputType == Enum.UserInputType.Touch) then
            local delta = input.Position - dragStart
            MainFrame.Position = UDim2.new(
                startPosition.X.Scale, startPosition.X.Offset + delta.X,
                startPosition.Y.Scale, startPosition.Y.Offset + delta.Y
            )
        end
    end)
end

--═════════ أدوات الأزرار ═════════--
local function AddToggle(text, callback, startOn)
    local button = Instance.new("TextButton")
    button.Size = UDim2.new(1, -10, 0, 44)
    button.BackgroundColor3 = startOn and Color3.fromRGB(38, 122, 72) or Color3.fromRGB(30, 30, 42)
    button.BorderSizePixel = 0
    button.AutoButtonColor = false
    button.TextColor3 = Color3.fromRGB(210, 210, 215)
    button.TextSize = 15
    button.Font = Enum.Font.GothamBold
    button.TextXAlignment = Enum.TextXAlignment.Left
    button.Parent = Content

    local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 10) corner.Parent = button
    local padding = Instance.new("UIPadding") padding.PaddingLeft = UDim.new(0, 12) padding.Parent = button

    local state = startOn and true or false
    local function Refresh()
        button.Text = text..(state and "  •  ON ✅" or "  •  OFF")
    end
    Refresh()

    button.MouseButton1Click:Connect(function()
        state = not state
        Refresh()
        TweenService:Create(button, TweenInfo.new(0.2), {
            BackgroundColor3 = state and Color3.fromRGB(38, 122, 72) or Color3.fromRGB(30, 30, 42)
        }):Play()
        pcall(callback, state)
    end)

    return { SetText = function(newText) text = newText Refresh() end }
end

local function AddButton(text, bgColor, callback)
    local button = Instance.new("TextButton")
    button.Size = UDim2.new(1, -10, 0, 44)
    button.BackgroundColor3 = bgColor or Color3.fromRGB(30, 30, 42)
    button.BorderSizePixel = 0
    button.Text = text
    button.TextColor3 = Color3.fromRGB(230, 230, 235)
    button.TextSize = 15
    button.Font = Enum.Font.GothamBold
    button.Parent = Content
    local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 10) corner.Parent = button
    button.MouseButton1Click:Connect(function() pcall(callback) end)
    return button
end

local function AddPresetRow(title, presets, onPreset)
    local holder = Instance.new("Frame")
    holder.Size = UDim2.new(1, -10, 0, 54)
    holder.BackgroundColor3 = Color3.fromRGB(30, 30, 42)
    holder.BorderSizePixel = 0
    holder.Parent = Content
    local rc = Instance.new("UICorner") rc.CornerRadius = UDim.new(0, 10) rc.Parent = holder

    local titleLbl = Instance.new("TextLabel")
    titleLbl.Size = UDim2.new(1, -8, 0, 14)
    titleLbl.Position = UDim2.new(0, 4, 0, 2)
    titleLbl.BackgroundTransparency = 1
    titleLbl.Text = title
    titleLbl.TextColor3 = Color3.fromRGB(140, 140, 155)
    titleLbl.TextSize = 11
    titleLbl.Font = Enum.Font.Gotham
    titleLbl.Parent = holder

    local count = #presets
    local btnW = (1 - 0.02) / count
    for i, preset in ipairs(presets) do
        local btn = Instance.new("TextButton")
        btn.Size = UDim2.new(btnW, -4, 0, 32)
        btn.Position = UDim2.new((i - 1) * btnW + 0.01, 0, 0, 18)
        btn.BackgroundColor3 = Color3.fromRGB(45, 100, 60)
        btn.BorderSizePixel = 0
        btn.Text = preset.label
        btn.TextColor3 = Color3.fromRGB(230, 230, 235)
        btn.TextSize = 15
        btn.Font = Enum.Font.GothamBold
        btn.Parent = holder
        local c = Instance.new("UICorner") c.CornerRadius = UDim.new(0, 8) c.Parent = btn
        btn.MouseButton1Click:Connect(function()
            print("[FroggeHub] 🎚️ "..title.." = "..tostring(preset.value))
            pcall(onPreset, preset.value)
        end)
    end
end

local function AddProgressBar()
    local holder = Instance.new("Frame")
    holder.Size = UDim2.new(1, -10, 0, 34)
    holder.BackgroundColor3 = Color3.fromRGB(30, 30, 42)
    holder.BorderSizePixel = 0
    holder.Parent = Content
    local rc = Instance.new("UICorner") rc.CornerRadius = UDim.new(0, 10) rc.Parent = holder

    local bar = Instance.new("Frame")
    bar.Size = UDim2.new(0, 0, 1, -6)
    bar.Position = UDim2.new(0, 3, 0, 3)
    bar.BackgroundColor3 = Color3.fromRGB(255, 200, 60)
    bar.BorderSizePixel = 0
    bar.Parent = holder
    local bc = Instance.new("UICorner") bc.CornerRadius = UDim.new(0, 8) bc.Parent = bar

    local lbl = Instance.new("TextLabel")
    lbl.Size = UDim2.new(1, -6, 1, -6)
    lbl.Position = UDim2.new(0, 3, 0, 3)
    lbl.BackgroundTransparency = 1
    lbl.TextColor3 = Color3.fromRGB(255, 255, 255)
    lbl.TextSize = 12
    lbl.Font = Enum.Font.GothamBold
    lbl.Text = ""
    lbl.ZIndex = 2
    lbl.Parent = holder

    return {
        Set = function(frac, text)
            if frac < 0 then frac = 0 end
            if frac > 1 then frac = 1 end
            bar.Size = UDim2.new(frac, -6, 1, -6)
            bar.Position = UDim2.new(0, 3, 0, 3)
            lbl.Text = text
        end
    }
end

--═════════ ⭐ دوال عرض المستوى ═════════--
local LevelHeaderBtn = nil
local LevelBar = nil

local function GetBadgeFromCharacter(char)
    local first = nil
    local extras = {}
    for _, d in ipairs(char:GetDescendants()) do
        if d.Name == "FroggeHub_LevelBadge" and d:IsA("BillboardGui") then
            if not first then
                first = d
            else
                table.insert(extras, d)
            end
        end
    end
    for _, e in ipairs(extras) do
        e:Destroy()
    end
    return first
end

local function CreateBadge(head, isMine)
    local bb = Instance.new("BillboardGui")
    bb.Name = "FroggeHub_LevelBadge"
    bb.Size = isMine and UDim2.new(0, 170, 0, 30) or UDim2.new(0, 200, 0, 28)
    bb.StudsOffset = Vector3.new(0, isMine and 2.4 or 2.2, 0)
    bb.AlwaysOnTop = true
    bb.Enabled = true
    bb.Parent = head

    local lbl = Instance.new("TextLabel")
    lbl.Name = "Label"
    lbl.Size = UDim2.new(1, 0, 1, 0)
    lbl.BackgroundTransparency = 1
    lbl.TextColor3 = isMine and Color3.fromRGB(255, 220, 100) or Color3.fromRGB(180, 220, 255)
    lbl.TextStrokeTransparency = 0.4
    lbl.TextSize = isMine and 14 or 12
    lbl.Font = Enum.Font.GothamBold
    lbl.Text = ""
    lbl.Parent = bb
    return bb
end

local function UpdateMyBadge()
    local myChar = LocalPlayer.Character
    if not myChar then return end
    local head = myChar:FindFirstChild("Head") or myChar:FindFirstChild("HumanoidRootPart")
    if not head then return end

    local badge = GetBadgeFromCharacter(myChar)
    if not ShowMyBadge then
        if badge then badge.Enabled = false end
        return
    end
    if not badge then
        badge = CreateBadge(head, true)
    end

    badge.Enabled = true
    if MyLevel >= 999 then
        badge.Label.Text = "🏆 Lv 999 (الأقصى!)"
    else
        badge.Label.Text = "⭐ Lv "..MyLevel.." • "..MyHelps.."/"..GetLevelTarget(MyLevel)
    end
end

local function UpdateOthersBadges()
    for _, plr in ipairs(Players:GetPlayers()) do
        if plr ~= LocalPlayer and plr.Character then
            local head = plr.Character:FindFirstChild("Head") or plr.Character:FindFirstChild("HumanoidRootPart")
            if head then
                local badge = GetBadgeFromCharacter(plr.Character)
                if not ShowOthersBadge then
                    if badge then badge:Destroy() end
                else
                    if not badge then
                        badge = CreateBadge(head, false)
                    end
                    local data = GetOrCreateLevelData(plr)
                    badge.Label.Text = "⭐ "..plr.Name.." • Lv "..data.level.." • "..data.helps.."/"..GetLevelTarget(data.level)
                end
            end
        end
    end
end

local function RefreshLevelUI()
    local target = GetLevelTarget(MyLevel)
    if MyLevel >= 999 then
        if LevelHeaderBtn then
            LevelHeaderBtn.Text = "🏆 المستوى: 999 (الأقصى!)"
        end
        if LevelBar then
            LevelBar.Set(1, "وصلت إلى أقصى مستوى!")
        end
    else
        if LevelHeaderBtn then
            LevelHeaderBtn.Text = "⭐ المستوى: "..MyLevel.." • المساعدات: "..MyHelps.."/"..target
        end
        if LevelBar then
            local frac = 0
            if target > 0 then frac = MyHelps / target end
            if frac > 1 then frac = 1 end
            LevelBar.Set(frac, MyHelps.." / "..target.." نحو المستوى "..(MyLevel + 1))
        end
    end
    UpdateMyBadge()
end

local function AddHelpForPlayer(plr, amount)
    if amount <= 0 then return end
    if plr == LocalPlayer then
        if MyLevel >= 999 then
            if not maxLevelNotified then
                maxLevelNotified = true
                NotifyMsg("rescue", "🏆 أقصى مستوى!", "وصلت إلى المستوى 999 - الحد الأقصى!", 8)
            end
            return
        end
        MyHelps = MyHelps + amount
        local target = GetLevelTarget(MyLevel)
        while MyHelps >= target and MyLevel < 999 do
            MyHelps = MyHelps - target
            MyLevel = MyLevel + 1
            NotifyMsg("rescue", "🎉 ترقية المستوى!", "ارتفعت إلى المستوى "..MyLevel.." ⭐ • الهدف القادم: "..GetLevelTarget(MyLevel).." مساعدة", 6)
            target = GetLevelTarget(MyLevel)
        end
        if MyLevel >= 999 then
            MyHelps = 0
            if not maxLevelNotified then
                maxLevelNotified = true
                NotifyMsg("rescue", "🏆 أقصى مستوى!", "وصلت إلى المستوى 999 - الحد الأقصى!", 8)
            end
        end
        SaveMyLevel()
        RefreshLevelUI()
        print("[⭐ نقطة لك!] المستوى "..MyLevel.." • التقدم "..MyHelps.."/"..GetLevelTarget(MyLevel))
    else
        local data = GetOrCreateLevelData(plr)
        if data.level >= 999 then return end
        data.helps = data.helps + amount
        local target = GetLevelTarget(data.level)
        while data.helps >= target and data.level < 999 do
            data.helps = data.helps - target
            data.level = data.level + 1
            NotifyMsg("info", "🎉 ترقية "..plr.Name.."!", "وصل إلى المستوى "..data.level.." ⭐", 4)
            target = GetLevelTarget(data.level)
        end
        if data.level >= 999 then data.helps = 0 end
        UpdateOthersBadges()
        print("[⭐ نقطة لـ "..plr.Name.."] المستوى "..data.level.." • التقدم "..data.helps.."/"..target)
    end
end

--═════════ 📋 قائمة الضفدع ═════════--
local PlayerListFrame = Instance.new("Frame")
PlayerListFrame.Size = UDim2.new(0, 280, 0, 380)
PlayerListFrame.Position = UDim2.new(0.5, -140, 0.5, -190)
PlayerListFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 30)
PlayerListFrame.BorderSizePixel = 0
PlayerListFrame.Visible = false
PlayerListFrame.ZIndex = 80
PlayerListFrame.Parent = ScreenGui

do
    local c = Instance.new("UICorner") c.CornerRadius = UDim.new(0, 14) c.Parent = PlayerListFrame
    local s = Instance.new("UIStroke") s.Color = Color3.fromRGB(170, 80, 30) s.Thickness = 2 s.Parent = PlayerListFrame
end

local ListTitle = Instance.new("TextLabel")
ListTitle.Size = UDim2.new(1, -70, 0, 34)
ListTitle.Position = UDim2.new(0, 12, 0, 8)
ListTitle.BackgroundTransparency = 1
ListTitle.Text = "👤 من هو الضفدع؟"
ListTitle.TextColor3 = Color3.fromRGB(255, 170, 80)
ListTitle.TextSize = 17
ListTitle.Font = Enum.Font.GothamBlack
ListTitle.TextXAlignment = Enum.TextXAlignment.Left
ListTitle.ZIndex = 81
ListTitle.Parent = PlayerListFrame

local CloseListBtn = Instance.new("TextButton")
CloseListBtn.Size = UDim2.new(0, 30, 0, 30)
CloseListBtn.Position = UDim2.new(1, -36, 0, 8)
CloseListBtn.BackgroundColor3 = Color3.fromRGB(150, 45, 50)
CloseListBtn.BorderSizePixel = 0
CloseListBtn.Text = "✕"
CloseListBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
CloseListBtn.TextSize = 16
CloseListBtn.Font = Enum.Font.GothamBold
CloseListBtn.ZIndex = 81
CloseListBtn.Parent = PlayerListFrame
do
    local c = Instance.new("UICorner") c.CornerRadius = UDim.new(0, 8) c.Parent = CloseListBtn
end

local PlayerScroll = Instance.new("ScrollingFrame")
PlayerScroll.Size = UDim2.new(1, -16, 1, -54)
PlayerScroll.Position = UDim2.new(0, 8, 0, 44)
PlayerScroll.BackgroundTransparency = 1
PlayerScroll.BorderSizePixel = 0
PlayerScroll.ScrollBarThickness = 4
PlayerScroll.ScrollBarImageColor3 = Color3.fromRGB(255, 170, 80)
PlayerScroll.CanvasSize = UDim2.new(0, 0, 0, 10)
PlayerScroll.ZIndex = 81
PlayerScroll.Parent = PlayerListFrame

CloseListBtn.MouseButton1Click:Connect(function()
    PlayerListFrame.Visible = false
end)

local function RefreshPlayerList()
    for _, child in ipairs(PlayerScroll:GetChildren()) do
        if child:IsA("TextButton") then child:Destroy() end
    end
    local count = 0
    for _, plr in ipairs(Players:GetPlayers()) do
        if plr ~= LocalPlayer then
            local isFrog = (plr == FrogPlayer)
            local data = GetOrCreateLevelData(plr)
            local btn = Instance.new("TextButton")
            btn.Size = UDim2.new(1, -8, 0, 38)
            btn.Position = UDim2.new(0, 4, 0, count * 44)
            btn.BackgroundColor3 = isFrog and Color3.fromRGB(170, 80, 30) or Color3.fromRGB(35, 35, 48)
            btn.BorderSizePixel = 0
            local dist = GetPlayersDistance(LocalPlayer, plr)
            local distTxt = dist and (" ["..math.floor(dist).."م]") or ""
            btn.Text = (isFrog and "🐸 " or "👤 ")..plr.Name.." • Lv "..data.level..distTxt
            btn.TextColor3 = Color3.fromRGB(230, 230, 235)
            btn.TextSize = 14
            btn.Font = Enum.Font.GothamBold
            btn.TextXAlignment = Enum.TextXAlignment.Left
            btn.ZIndex = 82
            btn.Parent = PlayerScroll
            local c = Instance.new("UICorner") c.CornerRadius = UDim.new(0, 8) c.Parent = btn

            btn.MouseButton1Click:Connect(function()
                FrogPlayer = plr
                PlayerListFrame.Visible = false
                local d = GetPlayersDistance(LocalPlayer, plr)
                local dTxt = d and (" • على "..FormatDistance(d)) or ""
                print("[FroggeHub] ✅ الضفدع الآن: "..plr.Name)
                NotifyMsg("info", "✅ تم اختيار الضفدع", "الضفدع هو: "..plr.Name..dTxt.." - الحماية نشطة 🛡️", 5)
                if FrogSelectBtn then
                    FrogSelectBtn.Text = "👹 الضفدع: "..plr.Name
                end
                RefreshPlayerList()
            end)
            count = count + 1
        end
    end
    PlayerScroll.CanvasSize = UDim2.new(0, 0, 0, count * 44 + 10)
end

--═════════ كشف الساقطين ═════════--
local function ParseTimerText(text)
    if text == nil then return nil end
    local t = tostring(text):gsub("%s+", "")
    if t == "" or #t > 6 then return nil end
    local n = tonumber(t)
    if n and n > 0 and n <= 99 then return n end
    local m, s = t:match("^(%d+):(%d+)$")
    if m and s then
        local total = tonumber(m) * 60 + tonumber(s)
        if total > 0 and total <= 99 then return total end
    end
    return nil
end

local function IsActuallyVisible(obj)
    local current = obj
    local steps = 0
    while current and steps < 12 do
        if current:IsA("BillboardGui") or current:IsA("SurfaceGui") or current:IsA("ScreenGui") then
            if not current.Enabled then return false end
        elseif current:IsA("GuiObject") then
            if not current.Visible then return false end
        else
            break
        end
        current = current.Parent
        steps = steps + 1
    end
    return true
end

local DownedConfirm = {}

local function GetDownedInfo(player)
    local char = player.Character
    if not char or not char.Parent then
        DownedConfirm[player] = nil
        return nil
    end

    for _, d in ipairs(char:GetDescendants()) do
        if d:IsA("TextLabel") or d:IsA("TextButton") then
            local anc = d:FindFirstAncestorOfClass("BillboardGui")
                or d:FindFirstAncestorOfClass("SurfaceGui")
            if anc and IsActuallyVisible(d) then
                local num = ParseTimerText(d.Text)
                if num then return num end
            end
        end
    end

    local hum = char:FindFirstChildOfClass("Humanoid")
    local root = char:FindFirstChild("HumanoidRootPart")
    if hum and root then
        local vel = root.AssemblyLinearVelocity
        local horizontal = Vector3.new(vel.X, 0, vel.Z).Magnitude
        if horizontal > 5 and hum:GetState() == Enum.HumanoidStateType.Running and not hum.PlatformStand then
            DownedConfirm[player] = nil
            return nil
        end
    end

    for _, d in ipairs(char:GetDescendants()) do
        if d:IsA("ProximityPrompt") and d.Enabled then
            return 999
        end
    end

    local iAmFollowing = (player == LocalPlayer) and followActive
    if hum and hum.Health > 0 and (hum.PlatformStand or hum:GetState() == Enum.HumanoidStateType.Physics) then
        if not iAmFollowing then
            DownedConfirm[player] = DownedConfirm[player] or os.clock()
            if os.clock() - DownedConfirm[player] >= 1.2 then
                return 999
            end
        end
    else
        if not iAmFollowing then DownedConfirm[player] = nil end
    end

    return nil
end

--═════════ أدوات الضفدع والأرض ═════════--
local function GetFrogRoot()
    if not FrogPlayer then return nil end
    local char = FrogPlayer.Character
    if not char then return nil end
    return char:FindFirstChild("HumanoidRootPart")
end

local function IsFrogNear(pos, radius)
    local root = GetFrogRoot()
    if not root then return false end
    return (root.Position - pos).Magnitude < radius
end

local function GetRayParams()
    local rayParams = RaycastParams.new()
    rayParams.FilterType = Enum.RaycastFilterType.Exclude
    local exclude = {}
    for _, plr in ipairs(Players:GetPlayers()) do
        if plr.Character then table.insert(exclude, plr.Character) end
    end
    rayParams.FilterDescendantsInstances = exclude
    return rayParams
end

local function RestoreCollision()
    local character = LocalPlayer.Character
    if character then
        for _, part in pairs(character:GetDescendants()) do
            if part:IsA("BasePart") and part.Name ~= "HumanoidRootPart"
            and not part.Parent:IsA("Accessory") then
                part.CanCollide = true
            end
        end
    end
end

--═════════ 🔘 الاندماج (اختياري - مطفي افتراضياً) ═════════--
local FOLLOW_OFFSET = -0.3

local function GetFollowCFrame(tRoot)
    local pos = tRoot.Position + Vector3.new(0, FOLLOW_OFFSET, 0)
    return CFrame.new(pos) * CFrame.Angles(math.rad(-90), 0, 0)
end

local function StopFollow()
    if followConn then followConn:Disconnect() followConn = nil end
    local wasActive = followActive
    followActive = false
    followTarget = nil
    followManual = false

    if wasActive then
        pcall(function()
            local myChar = LocalPlayer.Character
            local myRoot = myChar and myChar:FindFirstChild("HumanoidRootPart")
            if myRoot then
                myRoot.Anchored = false
            end
        end)
        if not States.Noclip then pcall(RestoreCollision) end
    end
end

local lastFollowCheck = 0

local function StartFollow(target, manual)
    StopFollow()
    local myChar = LocalPlayer.Character
    local myRoot = myChar and myChar:FindFirstChild("HumanoidRootPart")
    local tChar = target.Character
    local tRoot = tChar and tChar:FindFirstChild("HumanoidRootPart")
    if not (myRoot and tRoot) then return false end

    pcall(function()
        myRoot.Anchored = true
        for _, part in pairs(myChar:GetDescendants()) do
            if part:IsA("BasePart") then part.CanCollide = false end
        end
        myRoot.CFrame = GetFollowCFrame(tRoot)
    end)

    followTarget = target
    followManual = manual and true or false
    followActive = true

    followConn = RunService.RenderStepped:Connect(function()
        local mChar = LocalPlayer.Character
        local mRoot = mChar and mChar:FindFirstChild("HumanoidRootPart")
        local mHum = mChar and mChar:FindFirstChildOfClass("Humanoid")
        local tc = followTarget and followTarget.Character
        local tRoot2 = tc and tc:FindFirstChild("HumanoidRootPart")

        if not (mRoot and mHum and tRoot2) or mHum.Health <= 0 then
            StopFollow() return
        end
        if not mRoot.Anchored then mRoot.Anchored = true end

        if os.clock() - lastFollowCheck > 0.35 then
            lastFollowCheck = os.clock()
            if GetDownedInfo(followTarget) == nil then
                StopFollow()
                return
            end
            if States.Fly then StopFollow() return end
            if GetDownedInfo(LocalPlayer) ~= nil then StopFollow() return end
            if not followManual then
                if not States.Underground then StopFollow() return end
                if not (States.AutoTP or States.AutoRevive) then StopFollow() return end
            end
        end

        pcall(function()
            for _, part in pairs(mChar:GetDescendants()) do
                if part:IsA("BasePart") and part.CanCollide then part.CanCollide = false end
            end
        end)

        mRoot.CFrame = GetFollowCFrame(tRoot2)
    end)
    return true
end

--═════════ 🛡️ الهروب الآمن ═════════--
local lastSafePos = nil

local function FindSafeFlatSpot(centerPos, searchRadii, frogPos, minFrogDist)
    local rayParams = GetRayParams()
    local angles = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}
    local bestSpot, bestFrogDist = nil, 0

    for _, r in ipairs(searchRadii) do
        for _, a in ipairs(angles) do
            local ok, result = pcall(function()
                local rad = math.rad(a)
                local candidateX = centerPos.X + math.cos(rad) * r
                local candidateZ = centerPos.Z + math.sin(rad) * r
                local fromY = centerPos.Y + 80

                local hit = Workspace:Raycast(Vector3.new(candidateX, fromY, candidateZ), Vector3.new(0, -250, 0), rayParams)
                if not hit then return nil end
                local groundY = hit.Position.Y

                local flat = true
                local checks = {{2, 0}, {-2, 0}, {0, 2}, {0, -2}}
                for _, ck in ipairs(checks) do
                    local h2 = Workspace:Raycast(Vector3.new(candidateX + ck[1], fromY, candidateZ + ck[2]), Vector3.new(0, -250, 0), rayParams)
                    if not h2 then flat = false break end
                    if math.abs(h2.Position.Y - groundY) > 2.5 then flat = false break end
                end
                if not flat then return nil end

                return Vector3.new(candidateX, groundY + 3.5, candidateZ)
            end)

            if ok and result then
                if frogPos then
                    local fd = (Vector3.new(result.X, 0, result.Z) - Vector3.new(frogPos.X, 0, frogPos.Z)).Magnitude
                    if fd >= minFrogDist and fd > bestFrogDist then
                        bestSpot, bestFrogDist = result, fd
                    end
                else
                    return result
                end
            end
        end
    end
    return bestSpot
end

local function EscapeFromFrog()
    local myChar = LocalPlayer.Character
    local myRoot = myChar and myChar:FindFirstChild("HumanoidRootPart")
    local fRoot = GetFrogRoot()
    if not (myRoot and fRoot) then return false end

    if lastSafePos then
        local currentFrog = GetFrogRoot()
        if not currentFrog or (currentFrog.Position - lastSafePos).Magnitude > DANGER_RADIUS + 15 then
            pcall(function()
                myRoot.CFrame = CFrame.new(lastSafePos)
            end)
            return true
        end
    end

    local spot = FindSafeFlatSpot(myRoot.Position, {70, 45}, fRoot.Position, DANGER_RADIUS + 10)
    if spot then
        pcall(function()
            myRoot.CFrame = CFrame.new(spot)
        end)
        return true
    end

    spot = FindSafeFlatSpot(myRoot.Position, {70, 45}, fRoot.Position, 25)
    if spot then
        pcall(function()
            myRoot.CFrame = CFrame.new(spot)
        end)
        return true
    end

    local bestHelper, bestDist = nil, 0
    for _, plr in ipairs(Players:GetPlayers()) do
        if plr ~= LocalPlayer and plr ~= FrogPlayer then
            local c = plr.Character
            local hum = c and c:FindFirstChildOfClass("Humanoid")
            local root = c and c:FindFirstChild("HumanoidRootPart")
            if root and hum and hum.Health > 0 then
                local fd = (root.Position - fRoot.Position).Magnitude
                if fd > DANGER_RADIUS and fd > bestDist then
                    bestHelper, bestDist = plr, fd
                end
            end
        end
    end
    if bestHelper then
        local hRoot = bestHelper.Character:FindFirstChild("HumanoidRootPart")
        if hRoot then
            pcall(function()
                myRoot.CFrame = CFrame.new(hRoot.Position + Vector3.new(0, 3, 0))
            end)
            return true
        end
    end

    if lastSafePos then
        pcall(function()
            myRoot.CFrame = CFrame.new(lastSafePos)
        end)
        return true
    end

    print("[FroggeHub] ⚠️ لم أجد مكاناً آمناً - لم أنتقل (أمان)")
    return false
end

--═════════ 💚 الإحياء ═════════--
local function DoRevive(target)
    local char = target.Character
    if not char then return end

    local prompt
    for _, d in ipairs(char:GetDescendants()) do
        if d:IsA("ProximityPrompt") and d.Enabled then
            prompt = d
            break
        end
    end

    if prompt then
        pcall(function()
            if fireproximityprompt then fireproximityprompt(prompt) end
        end)
        pcall(function()
            if prompt.HoldDuration and prompt.HoldDuration > 0 then
                prompt:InputHoldBegin()
                task.wait(math.min(prompt.HoldDuration, 4) + 0.2)
                prompt:InputHoldEnd()
            end
        end)
    end

    pcall(function()
        VirtualInputManager:SendKeyEvent(true, REVIVE_KEY, false, game)
    end)

    local t0 = os.clock()
    local taps = 0
    while os.clock() - t0 < E_HOLD_MAX do
        task.wait(0.15)
        taps = taps + 1

        if GetDownedInfo(target) == nil then
            creditedByMe[target] = true
            Stats.reviveSuccess = Stats.reviveSuccess + 1
            NotifyMsg("rescue", "💚 إحياء ناجح!", "أحييت "..target.Name.." - النقاط توزع عند قيامه ⭐", 3)
            break
        end
        if GetDownedInfo(LocalPlayer) ~= nil then break end

        local tChar = target.Character
        local tRoot = tChar and tChar:FindFirstChild("HumanoidRootPart")
        local mChar = LocalPlayer.Character
        local mRoot = mChar and mChar:FindFirstChild("HumanoidRootPart")
        if tRoot and mRoot then
            local d = (tRoot.Position - mRoot.Position).Magnitude
            if not followActive then
                if IsFrogNear(tRoot.Position, GUARD_RADIUS) then break end
                if d > 8 then
                    pcall(function()
                        mRoot.CFrame = CFrame.new(tRoot.Position + Vector3.new(0, 2.5, 0))
                    end)
                end
                if d > 25 then break end
            end
        else
            break
        end

        if prompt and taps % 10 == 0 then
            pcall(function()
                if fireproximityprompt then fireproximityprompt(prompt) end
            end)
        end
    end

    pcall(function()
        VirtualInputManager:SendKeyEvent(false, REVIVE_KEY, false, game)
    end)
end

local function SafeRevive(target)
    IsReviving = true
    pcall(DoRevive, target)
    IsReviving = false
end

--═════════ 😴 نقل عند شخص حي ═════════--
local function GetBestHelperPlayer()
    local myChar = LocalPlayer.Character
    local myRoot = myChar and myChar:FindFirstChild("HumanoidRootPart")
    if not myRoot then return nil end

    local best, bestDist = nil, math.huge
    for _, plr in ipairs(Players:GetPlayers()) do
        if plr ~= LocalPlayer and plr ~= FrogPlayer then
            local c = plr.Character
            local hum = c and c:FindFirstChildOfClass("Humanoid")
            local root = c and c:FindFirstChild("HumanoidRootPart")
            if root and hum and hum.Health > 0 and GetDownedInfo(plr) == nil then
                local d = (root.Position - myRoot.Position).Magnitude
                if not IsFrogNear(root.Position, DANGER_RADIUS + 10) then
                    if d < bestDist then best, bestDist = plr, d end
                end
            end
        end
    end
    return best
end

local function TeleportToHelperForRescue()
    local helper = GetBestHelperPlayer()
    if not helper then return false, nil end
    local myChar = LocalPlayer.Character
    local myRoot = myChar and myChar:FindFirstChild("HumanoidRootPart")
    local hChar = helper.Character
    local hRoot = hChar and hChar:FindFirstChild("HumanoidRootPart")
    if not (myRoot and hRoot) then return false, nil end

    pcall(function()
        myRoot.CFrame = CFrame.new(hRoot.Position + hRoot.CFrame.LookVector * 2.5 + Vector3.new(0, 1.5, 0))
    end)
    return true, helper
end

--═════════ 🚀 الانتقال السريع ═════════--
local lastManualTP = 0

local function GetBestRescueTarget()
    local myChar = LocalPlayer.Character
    local myRoot = myChar and myChar:FindFirstChild("HumanoidRootPart")
    if not myRoot then return nil end

    local best, bestNum, bestDist = nil, math.huge, math.huge
    for _, plr in ipairs(Players:GetPlayers()) do
        if plr ~= LocalPlayer and plr ~= FrogPlayer then
            local num = GetDownedInfo(plr)
            if num then
                local tRoot = plr.Character and plr.Character:FindFirstChild("HumanoidRootPart")
                local guarded = tRoot and IsFrogNear(tRoot.Position, GUARD_RADIUS)
                if not guarded and tRoot then
                    local dist = (myRoot.Position - tRoot.Position).Magnitude
                    if num < bestNum or (num == bestNum and dist < bestDist) then
                        best, bestNum, bestDist = plr, num, dist
                    end
                end
            end
        end
    end
    return best
end

local function ManualTeleport(fromButton, skipIfClose)
    if os.clock() - lastManualTP < 0.6 then return end

    local myChar = LocalPlayer.Character
    local myRoot = myChar and myChar:FindFirstChild("HumanoidRootPart")
    local myHum = myChar and myChar:FindFirstChildOfClass("Humanoid")
    if not (myRoot and myHum and myHum.Health > 0) then return end
    if GetDownedInfo(LocalPlayer) then return end

    local best = GetBestRescueTarget()
    if not best then
        if fromButton then
            NotifyMsg("info", "🚀 الانتقال السريع", "لا يوجد لاعب ساقط حالياً 👀", 2)
        end
        return
    end

    if skipIfClose then
        local tRoot = best.Character and best.Character:FindFirstChild("HumanoidRootPart")
        if tRoot and (tRoot.Position - myRoot.Position).Magnitude < 12 then
            return
        end
    end

    if followActive and followManual and followTarget == best then
        if fromButton then
            NotifyMsg("info", "🚀 الانتقال السريع", "أنت ترافقه بالفعل 💚", 2)
        end
        return
    end

    lastManualTP = os.clock()
    local dist = GetPlayersDistance(LocalPlayer, best)
    local distTxt = dist and (" • كانت المسافة "..FormatDistance(dist)) or ""
    if States.Underground then
        if StartFollow(best, true) then
            Stats.rescues = Stats.rescues + 1
            NotifyMsg("rescue", "🚀 اندماج ومرافقة", "تم نقلك إلى داخل جسد "..best.Name..distTxt.." - سأبقى معه حتى يستيقظ", 3)
        end
    else
        local tChar = best.Character
        local tRoot = tChar and tChar:FindFirstChild("HumanoidRootPart")
        if tRoot and myRoot then
            pcall(function()
                myRoot.CFrame = CFrame.new(tRoot.Position + Vector3.new(0, 2.5, 0))
            end)
            Stats.rescues = Stats.rescues + 1
            NotifyMsg("rescue", "🚀 انتقال سريع", "تم نقلك فوق "..best.Name..distTxt.." (واقف)", 2)
        end
    end
end

--═════════ 🧠 الحلقة الرئيسية ═════════--
local announcedDown = {}
local guardAnnounced = {}
local currentTarget = nil
local selfDownNotified = false
local lastHelpMeTP = 0
local lastEscapeAttempt = 0
local lastWarnTime = 0
local StatusFlags = { danger = 0, guardName = nil, helpme = false, warned = false }

task.spawn(function()
    while ScreenGui.Parent do
        task.wait(0.2)
        pcall(function()
            local myChar = LocalPlayer.Character
            local myHum = myChar and myChar:FindFirstChildOfClass("Humanoid")
            local myRoot = myChar and myChar:FindFirstChild("HumanoidRootPart")
            if not (myRoot and myHum) then return end

            StatusFlags.helpme = false
            StatusFlags.guardName = nil

            if myHum.Health <= 0 then return end

            -- ⓪ تنبيه مسبق (20م)
            if States.SelfEscape and not followActive then
                local fRootNow = GetFrogRoot()
                if fRootNow then
                    local dw = (fRootNow.Position - myRoot.Position).Magnitude
                    if dw < WARN_RADIUS and dw >= DANGER_RADIUS then
                        if os.clock() - lastWarnTime > 10 then
                            lastWarnTime = os.clock()
                            Stats.warnings = Stats.warnings + 1
                            StatusFlags.warned = true
                            NotifyMsg("danger", "⚠️ الضفدع يقرّب!", "على "..FormatDistance(dw).." منك - استعد للهروب", 3)
                        end
                    end
                end
            end

            -- ① الهروب (10م فقط!)
            if States.SelfEscape and not followActive then
                local fRootNow = GetFrogRoot()
                if fRootNow then
                    local d = (fRootNow.Position - myRoot.Position).Magnitude
                    if d < DANGER_RADIUS then
                        if os.clock() - lastEscapeAttempt > ESCAPE_COOLDOWN then
                            lastEscapeAttempt = os.clock()
                            StatusFlags.danger = os.clock()
                            local escaped = EscapeFromFrog()
                            if escaped then
                                Stats.escapes = Stats.escapes + 1
                                NotifyMsg("danger", "🛡️ هروب تلقائي!", "الضفدع اقترب منك ("..FormatDistance(d)..") - تم نقلك إلى مكان آمن 🏃", 3)
                            end
                        end
                        return
                    end
                end
            end

            -- ② أنا ساقط؟
            local myInfo = GetDownedInfo(LocalPlayer)
            if myInfo then
                StatusFlags.helpme = true
                if followActive then StopFollow() end
                if not selfDownNotified then
                    selfDownNotified = true
                    currentTarget = nil
                    NotifyMsg("rescue", "😴 لقد سقطت!", "ستتم محاولة نقلك إلى أقرب لاعب سليم 💚", 5)
                end
                if (States.AutoTP or States.AutoRevive) and os.clock() - lastHelpMeTP > 2 then
                    lastHelpMeTP = os.clock()
                    local ok, helper = TeleportToHelperForRescue()
                    if ok and helper then
                        local d = GetPlayersDistance(LocalPlayer, helper)
                        local dTxt = d and (" • على "..FormatDistance(d)) or ""
                        NotifyMsg("rescue", "😴 تم نقلك", "أنت الآن بجوار "..helper.Name..dTxt.." - اطلب منه إحياءك!", 4)
                    end
                end
                return
            end
            selfDownNotified = false

            -- ③ كشف الساقطين + النقاط
            local downed = {}
            for _, plr in ipairs(Players:GetPlayers()) do
                if plr ~= LocalPlayer and plr ~= FrogPlayer then
                    local num = GetDownedInfo(plr)
                    if num then
                        local tRoot = plr.Character and plr.Character:FindFirstChild("HumanoidRootPart")
                        local guarded = tRoot and IsFrogNear(tRoot.Position, GUARD_RADIUS)
                        if guarded then
                            if not guardAnnounced[plr] then
                                guardAnnounced[plr] = true
                                NotifyMsg("rescue", "⏳ الضفدع يحرس "..plr.Name, "ننتظر ابتعاده...", 3)
                            end
                            StatusFlags.guardName = plr.Name
                            if currentTarget == plr then currentTarget = nil end
                        else
                            downed[plr] = num
                            if guardAnnounced[plr] then
                                guardAnnounced[plr] = nil
                                NotifyMsg("rescue", "💨 ابتعد الضفدع عن "..plr.Name, "بإمكاننا إنقاذه الآن! 🏃", 3)
                            end
                            if not announcedDown[plr] then
                                announcedDown[plr] = {t = os.clock(), char = plr.Character}
                                local d = GetPlayersDistance(LocalPlayer, plr)
                                local dTxt = d and (" • على "..FormatDistance(d)) or ""
                                local timerTxt = (num <= 99) and (" • المتبقي: "..math.floor(num).." ثانية") or ""
                                NotifyMsg("rescue", "🚨 سقوط: "..plr.Name, "وقع اللاعب"..dTxt..timerTxt.." 🏃", 3)
                            end

                            if tRoot then
                                downedHelpers[plr] = downedHelpers[plr] or {}
                                for _, other in ipairs(Players:GetPlayers()) do
                                    if other ~= plr and other ~= FrogPlayer then
                                        local oc = other.Character
                                        local oroot = oc and oc:FindFirstChild("HumanoidRootPart")
                                        if oroot then
                                            local dd = (oroot.Position - tRoot.Position).Magnitude
                                            if dd < HELPER_RADIUS then
                                                downedHelpers[plr][other] = os.clock()
                                            end
                                        end
                                    end
                                end
                            end
                        end
                    else
                        local info = announcedDown[plr]
                        announcedDown[plr] = nil
                        guardAnnounced[plr] = nil
                        if info and os.clock() - info.t > 1.5 then
                            local c = plr.Character
                            local h = c and c:FindFirstChildOfClass("Humanoid")
                            if h and h.Health > 0 and info.char == c then
                                local helpers = downedHelpers[plr] or {}
                                if creditedByMe[plr] then
                                    helpers[LocalPlayer] = os.clock()
                                    creditedByMe[plr] = nil
                                end
                                local tRoot = c:FindFirstChild("HumanoidRootPart")
                                if tRoot then
                                    for _, other in ipairs(Players:GetPlayers()) do
                                        if other ~= plr and other ~= FrogPlayer then
                                            local oc = other.Character
                                            local oroot = oc and oc:FindFirstChild("HumanoidRootPart")
                                            if oroot then
                                                local dd = (oroot.Position - tRoot.Position).Magnitude
                                                if dd < HELPER_RADIUS then
                                                    helpers[other] = os.clock()
                                                end
                                            end
                                        end
                                    end
                                end
                                local count = 0
                                local names = {}
                                for helper, lastSeen in pairs(helpers) do
                                    if os.clock() - lastSeen < HELPER_FRESH then
                                        AddHelpForPlayer(helper, 1)
                                        count = count + 1
                                        table.insert(names, helper.Name)
                                    end
                                end
                                if count > 1 then
                                    NotifyMsg("rescue", "🌟 إحياء جماعي! +"..count.." نقاط", "استيقظ "..plr.Name.." بمساعدة "..count.." لاعبين: "..table.concat(names, "، "), 5)
                                elseif count == 1 then
                                    NotifyMsg("rescue", "⭐ إحياء ناجح! +1", "استيقظ "..plr.Name.." • المساعد: "..names[1], 4)
                                else
                                    NotifyMsg("rescue", "💚 استيقظ "..plr.Name, "تعافى من السقوط", 2)
                                end
                            elseif info.char ~= c then
                                NotifyMsg("rescue", "💀 للأسف", "انتهى وقت "..plr.Name.."...", 2)
                            end
                        end
                        downedHelpers[plr] = nil
                    end
                end
            end

            -- ④ أفعال الإنقاذ
            if not (States.AutoTP or States.AutoRevive) then
                if followActive and not followManual then StopFollow() end
                currentTarget = nil
                return
            end

            if currentTarget and not downed[currentTarget] then
                currentTarget = nil
            end
            if not currentTarget then
                local bestNum = math.huge
                for plr, num in pairs(downed) do
                    if num < bestNum then
                        bestNum = num
                        currentTarget = plr
                    end
                end
            end

            if currentTarget then
                local theirChar = currentTarget.Character
                local theirRoot = theirChar and theirChar:FindFirstChild("HumanoidRootPart")

                if theirRoot and myRoot then
                    if States.Underground then
                        if not followActive or followTarget ~= currentTarget then
                            if StartFollow(currentTarget, false) then
                                Stats.rescues = Stats.rescues + 1
                                local d = GetPlayersDistance(LocalPlayer, currentTarget)
                                local dTxt = d and (" • على "..FormatDistance(d)) or ""
                                NotifyMsg("rescue", "🔘 اندماج", "تم الدمج مع جسد "..currentTarget.Name..dTxt.." - سأبقى معه حتى يستيقظ", 3)
                            end
                        end
                        if States.AutoRevive then
                            SafeRevive(currentTarget)
                        end
                    else
                        -- الانتقال واقف (بلا دمج)
                        local dist = (theirRoot.Position - myRoot.Position).Magnitude
                        if States.AutoTP and dist > 9 then
                            pcall(function()
                                myRoot.CFrame = CFrame.new(theirRoot.Position + Vector3.new(0, 2.5, 0))
                            end)
                        end
                        if States.AutoRevive and dist <= 15 then
                            if not IsFrogNear(myRoot.Position, DANGER_RADIUS) then
                                SafeRevive(currentTarget)
                            end
                        end
                    end
                else
                    currentTarget = nil
                end
            end
        end)
    end
end)

Players.PlayerRemoving:Connect(function(plr)
    announcedDown[plr] = nil
    guardAnnounced[plr] = nil
    DownedConfirm[plr] = nil
    creditedByMe[plr] = nil
    downedHelpers[plr] = nil
    LevelData[plr] = nil
    if currentTarget == plr then currentTarget = nil end
    if followTarget == plr then StopFollow() end
    if FrogPlayer == plr then
        FrogPlayer = nil
        if FrogSelectBtn then
            FrogSelectBtn.Text = "🎯 اختر الضفدع (لاعب)"
        end
        NotifyMsg("info", "⚠️ غادر الضفدع", "لقد غادر الخادم - اختر ضفدعاً جديداً", 4)
    end
    for _, helpers in pairs(downedHelpers) do
        helpers[plr] = nil
    end
end)

--═════════ شريط الحالة ═════════--
task.spawn(function()
    while ScreenGui.Parent do
        task.wait(0.5)
        pcall(function()
            if StatusFlags.helpme then
                StatusLabel.Text = "😴 لقد سقطت - جارٍ نقلك إلى أقرب لاعب سليم..."
                StatusLabel.TextColor3 = Color3.fromRGB(255, 160, 80)
            elseif followActive then
                StatusLabel.Text = "🔘 مدموج مع "..(followTarget and followTarget.Name or "؟").." • ⭐ Lv "..MyLevel
                StatusLabel.TextColor3 = Color3.fromRGB(120, 220, 160)
            elseif os.clock() - StatusFlags.danger < 2.5 then
                StatusLabel.Text = "🛡️ هروب! ("..Stats.escapes.." هروبات)"
                StatusLabel.TextColor3 = Color3.fromRGB(255, 80, 80)
            elseif StatusFlags.warned and os.clock() - lastWarnTime < 5 then
                StatusLabel.Text = "⚠️ الضفدع يقرّب! ("..WARN_RADIUS.."م)"
                StatusLabel.TextColor3 = Color3.fromRGB(255, 200, 80)
                StatusFlags.warned = false
            elseif StatusFlags.guardName then
                StatusLabel.Text = "⏳ الضفدع يحرس "..StatusFlags.guardName.." - ننتظر..."
                StatusLabel.TextColor3 = Color3.fromRGB(255, 200, 80)
            elseif currentTarget then
                local num = GetDownedInfo(currentTarget)
                local timerTxt = (num and num <= 99) and (" ⏱️"..math.floor(num).."ث") or ""
                StatusLabel.Text = "📍 عند "..currentTarget.Name..timerTxt.." (واقف)"
                StatusLabel.TextColor3 = Color3.fromRGB(255, 100, 100)
            elseif FrogPlayer then
                local fRoot = GetFrogRoot()
                local myChar = LocalPlayer.Character
                local myRoot = myChar and myChar:FindFirstChild("HumanoidRootPart")
                if fRoot and myRoot then
                    local d = math.floor((fRoot.Position - myRoot.Position).Magnitude)
                    StatusLabel.Text = "👹 الضفدع ["..FrogPlayer.Name.."] • يبعد "..d.." متراً • ⭐ Lv "..MyLevel
                else
                    StatusLabel.Text = "👹 الضفدع: "..FrogPlayer.Name.." • ⭐ Lv "..MyLevel
                end
                StatusLabel.TextColor3 = Color3.fromRGB(130, 170, 130)
            else
                StatusLabel.Text = "👀 أراقب • ⭐ Lv "..MyLevel.." ("..MyHelps.."/"..GetLevelTarget(MyLevel)..") • "..Stats.rescues.." إنقاذ"
                StatusLabel.TextColor3 = Color3.fromRGB(85, 220, 130)
            end
        end)
    end
end)

--═════════ ⚡ السرعة + القفز + Anti-AFK ═════════--
task.spawn(function()
    while ScreenGui.Parent do
        RunService.Heartbeat:Wait()
        if States.Speed and not followActive then
            local character = LocalPlayer.Character
            local humanoid = character and character:FindFirstChildOfClass("Humanoid")
            if humanoid and humanoid.WalkSpeed ~= SpeedValue then
                humanoid.WalkSpeed = SpeedValue
            end
        end
    end
end)

UserInputService.JumpRequest:Connect(function()
    if followActive then StopFollow() end
    if States.InfJump then
        local character = LocalPlayer.Character
        local humanoid = character and character:FindFirstChildOfClass("Humanoid")
        if humanoid then
            humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
        end
    end
end)

LocalPlayer.Idled:Connect(function()
    if States.AntiAFK then
        VirtualUser:CaptureController()
        VirtualUser:ClickButton2(Vector2.new())
    end
end)

RunService.Stepped:Connect(function()
    if (States.Noclip or followActive) and LocalPlayer.Character then
        for _, part in pairs(LocalPlayer.Character:GetDescendants()) do
            if part:IsA("BasePart") and part.CanCollide then
                part.CanCollide = false
            end
        end
    end
end)

--═════════ 💡 الإضاءة ═════════--
local OriginalLighting = {
    Brightness = Lighting.Brightness,
    ClockTime = Lighting.ClockTime,
    FogEnd = Lighting.FogEnd,
    GlobalShadows = Lighting.GlobalShadows,
}

local function SetFullbright(enabled)
    if enabled then
        Lighting.Brightness = 3
        Lighting.ClockTime = 14
        Lighting.FogEnd = 100000
        Lighting.GlobalShadows = false
    else
        Lighting.Brightness = OriginalLighting.Brightness
        Lighting.ClockTime = OriginalLighting.ClockTime
        Lighting.FogEnd = OriginalLighting.FogEnd
        Lighting.GlobalShadows = OriginalLighting.GlobalShadows
    end
end

task.spawn(function()
    while ScreenGui.Parent do
        task.wait(1)
        if States.Fullbright then pcall(SetFullbright, true) end
    end
end)

--═════════ 👁️ ESP ═════════--
local ESPHighlights = {}

local function CleanESP(player)
    if player.Character then
        for _, object in pairs(player.Character:GetDescendants()) do
            if object.Name == "FroggeHub_ESP" then object:Destroy() end
        end
    end
    ESPHighlights[player] = nil
end

local function UpdateESP()
    for _, plr in ipairs(Players:GetPlayers()) do
        if plr ~= LocalPlayer and plr.Character then
            local hl = ESPHighlights[plr]
            if States.ESP then
                if not hl or not hl.Parent then
                    local newHl = Instance.new("Highlight")
                    newHl.Name = "FroggeHub_ESP"
                    newHl.FillTransparency = 0.75
                    newHl.OutlineColor = Color3.fromRGB(255, 255, 255)
                    newHl.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
                    newHl.Parent = plr.Character
                    ESPHighlights[plr] = newHl
                    hl = newHl
                end
                if plr == FrogPlayer then
                    hl.FillColor = Color3.fromRGB(170, 60, 200)
                elseif GetDownedInfo(plr) then
                    hl.FillColor = Color3.fromRGB(255, 85, 85)
                else
                    hl.FillColor = Color3.fromRGB(85, 255, 127)
                end
            else
                CleanESP(plr)
            end
        end
    end
end

task.spawn(function()
    while ScreenGui.Parent do
        task.wait(1)
        pcall(UpdateESP)
    end
end)

--═════════ 🕊️ الطيران ═════════--
local FlyUp, FlyDown = false, false
local FlyUpBtn, FlyDownBtn

do
    local function MakeFlyBtn(text, posY)
        local btn = Instance.new("TextButton")
        btn.Size = UDim2.new(0, 46, 0, 46)
        btn.Position = UDim2.new(1, -60, 0.45, posY)
        btn.BackgroundColor3 = Color3.fromRGB(38, 122, 72)
        btn.BorderSizePixel = 0
        btn.Text = text
        btn.TextSize = 20
        btn.Font = Enum.Font.GothamBold
        btn.TextColor3 = Color3.new(1, 1, 1)
        btn.Visible = false
        btn.ZIndex = 40
        btn.Parent = ScreenGui
        local c = Instance.new("UICorner") c.CornerRadius = UDim.new(1, 0) c.Parent = btn
        return btn
    end
    FlyUpBtn = MakeFlyBtn("▲", -52)
    FlyDownBtn = MakeFlyBtn("▼", 4)

    local function BindHold(btn, setState)
        btn.InputBegan:Connect(function(input)
            if input.UserInputType == Enum.UserInputType.MouseButton1
            or input.UserInputType == Enum.UserInputType.Touch then
                setState(true)
            end
        end)
        btn.InputEnded:Connect(function(input)
            if input.UserInputType == Enum.UserInputType.MouseButton1
            or input.UserInputType == Enum.UserInputType.Touch then
                setState(false)
            end
        end)
    end
    BindHold(FlyUpBtn, function(v) FlyUp = v end)
    BindHold(FlyDownBtn, function(v) FlyDown = v end)
end

UserInputService.InputBegan:Connect(function(input)
    if States.Fly then
        if input.KeyCode == Enum.KeyCode.Space then FlyUp = true
        elseif input.KeyCode == Enum.KeyCode.LeftShift then FlyDown = true end
    end
end)

UserInputService.InputEnded:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.Space then FlyUp = false
    elseif input.KeyCode == Enum.KeyCode.LeftShift then FlyDown = false end
end)

local function StartFly()
    local character = LocalPlayer.Character
    local rootPart = character and character:FindFirstChild("HumanoidRootPart")
    if not rootPart then return end

    local bodyVelocity = Instance.new("BodyVelocity")
    bodyVelocity.Name = "FroggeHub_Fly"
    bodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
    bodyVelocity.Velocity = Vector3.new()
    bodyVelocity.Parent = rootPart

    local bodyGyro = Instance.new("BodyGyro")
    bodyGyro.Name = "FroggeHub_Gyro"
    bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
    bodyGyro.P = 9000
    bodyGyro.D = 500
    bodyGyro.Parent = rootPart

    task.spawn(function()
        while States.Fly and ScreenGui.Parent do
            RunService.RenderStepped:Wait()
            local currentChar = LocalPlayer.Character
            local currentRoot = currentChar and currentChar:FindFirstChild("HumanoidRootPart")
            local humanoid = currentChar and currentChar:FindFirstChildOfClass("Humanoid")
            local camera = Workspace.CurrentCamera
            if currentRoot and humanoid and camera then
                if bodyVelocity.Parent ~= currentRoot then
                    bodyVelocity.Parent = currentRoot
                    bodyGyro.Parent = currentRoot
                end
                bodyGyro.CFrame = camera.CFrame
                local velocity = humanoid.MoveDirection * FlySpeed
                if FlyUp then velocity = velocity + Vector3.new(0, FlySpeed, 0) end
                if FlyDown then velocity = velocity - Vector3.new(0, FlySpeed, 0) end
                bodyVelocity.Velocity = velocity
            end
        end
        bodyVelocity:Destroy()
        bodyGyro:Destroy()
    end)
end

--═════════ 🚀 زر الانتقال السريع ═════════--
local QuickTPButton = Instance.new("TextButton")
QuickTPButton.Size = UDim2.new(0, 58, 0, 58)
QuickTPButton.Position = UDim2.new(1, -74, 0.6, 0)
QuickTPButton.BackgroundColor3 = Color3.fromRGB(205, 115, 40)
QuickTPButton.BorderSizePixel = 0
QuickTPButton.Text = "🚀"
QuickTPButton.TextSize = 26
QuickTPButton.Font = Enum.Font.GothamBold
QuickTPButton.TextColor3 = Color3.new(1, 1, 1)
QuickTPButton.ZIndex = 50
QuickTPButton.Parent = ScreenGui

do
    local c = Instance.new("UICorner") c.CornerRadius = UDim.new(1, 0) c.Parent = QuickTPButton
    local s = Instance.new("UIStroke") s.Color = Color3.fromRGB(255, 170, 80) s.Thickness = 2 s.Parent = QuickTPButton
end

QuickTPButton.MouseButton1Click:Connect(function()
    ManualTeleport(true, false)
end)

--═════════ أزرار القائمة ═════════--
local NotifyLevelBtn = AddButton("📢 الإشعارات: كل شيء", Color3.fromRGB(60, 80, 140), function()
    if NotifyLevel == "all" then
        NotifyLevel = "important"
        NotifyLevelBtn.Text = "📢 الإشعارات: المهم فقط"
        NotifyMsg("info", "📢 الإشعارات", "تم التبديل إلى: المهم فقط", 3)
    elseif NotifyLevel == "important" then
        NotifyLevel = "off"
        NotifyLevelBtn.Text = "📢 الإشعارات: مغلقة 🔕"
        task.spawn(function()
            pcall(function()
                StarterGui:SetCore("SendNotification", {
                    Title = "📢 الإشعارات",
                    Text = "تم إغلاق الإشعارات - اضغط الزر مجدداً لإعادتها",
                    Duration = 3,
                })
            end)
        end)
        print("[🐸] تم إغلاق الإشعارات")
    else
        NotifyLevel = "all"
        NotifyLevelBtn.Text = "📢 الإشعارات: كل شيء"
        NotifyMsg("info", "📢 الإشعارات", "تم تفعيل جميع الإشعارات ✅", 3)
    end
end)

AddButton("📊 الراوتر الذكي (تقرير شامل)", Color3.fromRGB(90, 60, 130), function()
    local fRoot = GetFrogRoot()
    local frogDist = 0
    if fRoot then
        local myChar = LocalPlayer.Character
        local myRoot = myChar and myChar:FindFirstChild("HumanoidRootPart")
        if myRoot then
            frogDist = math.floor((fRoot.Position - myRoot.Position).Magnitude)
        end
    end

    local downedCount = 0
    for _, plr in ipairs(Players:GetPlayers()) do
        if plr ~= LocalPlayer and GetDownedInfo(plr) then
            downedCount = downedCount + 1
        end
    end

    local report = "📊 تقرير شامل:\n"..
        "⭐ المستوى: "..MyLevel.." ("..MyHelps.."/"..GetLevelTarget(MyLevel)..")\n"..
        "🚀 هروبات: "..Stats.escapes.." | تحذيرات: "..Stats.warnings.."\n"..
        "💚 إنقاذات: "..Stats.rescues.." | إحياءات: "..Stats.reviveSuccess.."\n"..
        "🛡️ الضفدع: "..(FrogPlayer and FrogPlayer.Name or "غير محدد").." • يبعد "..frogDist.."م\n"..
        "🚨 ساقطين حالياً: "..downedCount.." | وضع: "..(followActive and "مدموج 🔘" or "مراقبة 👀")

    print(report)
    NotifyMsg("info", "📊 الراوتر الذكي", report, 8)
end)

LevelHeaderBtn = AddButton("⭐ المستوى: "..MyLevel.." • المساعدات: "..MyHelps.."/"..GetLevelTarget(MyLevel), Color3.fromRGB(120, 90, 25), function()
    local target = GetLevelTarget(MyLevel)
    if MyLevel >= 999 then
        NotifyMsg("info", "🏆 مستواك", "أنت في أقصى مستوى: 999! 🏆", 5)
    else
        NotifyMsg("info", "⭐ مستواك", "المستوى: "..MyLevel.." • التقدم: "..MyHelps.."/"..target.." • تحتاج "..(target - MyHelps).." للترقية", 5)
    end
end)

LevelBar = AddProgressBar()

local MyBadgeBtn = AddButton("🏷️ الشعار فوق راسي: ظاهر", Color3.fromRGB(45, 90, 130), function()
    ShowMyBadge = not ShowMyBadge
    MyBadgeBtn.Text = ShowMyBadge and "🏷️ الشعار فوق راسي: ظاهر" or "🏷️ الشعار فوق راسي: مخفي"
    UpdateMyBadge()
end)

local OthersBadgeBtn = AddButton("👥 شعارات اللاعبين: ظاهرة", Color3.fromRGB(45, 90, 130), function()
    ShowOthersBadge = not ShowOthersBadge
    OthersBadgeBtn.Text = ShowOthersBadge and "👥 شعارات اللاعبين: ظاهرة" or "👥 شعارات اللاعبين: مخفية"
    UpdateOthersBadges()
end)

AddButton("🗑️ تصفير مستواي", Color3.fromRGB(80, 50, 50), function()
    MyLevel = 1
    MyHelps = 0
    maxLevelNotified = false
    SaveMyLevel()
    RefreshLevelUI()
    NotifyMsg("info", "🗑️ التصفير", "تمت إعادة مستواك إلى المستوى 1", 3)
end)

FrogSelectBtn = AddButton("🎯 اختر الضفدع (لاعب)", Color3.fromRGB(170, 80, 30), function()
    RefreshPlayerList()
    PlayerListFrame.Visible = true
end)

AddButton("🧪 فحص الضفدع والهروب", Color3.fromRGB(70, 90, 160), function()
    local myChar = LocalPlayer.Character
    local myRoot = myChar and myChar:FindFirstChild("HumanoidRootPart")
    if not FrogPlayer then
        NotifyMsg("info", "🧪 الفحص", "لم تختر ضفدعاً بعد! اختره أولاً", 4)
        return
    end
    local fRoot = GetFrogRoot()
    if fRoot and myRoot then
        local d = math.floor((fRoot.Position - myRoot.Position).Magnitude)
        print("[FroggeHub] 🧪 الضفدع على "..d.."م • الهروب تحت "..DANGER_RADIUS.."م • مفعّل: "..tostring(States.SelfEscape))
        NotifyMsg("info", "🧪 نتيجة الفحص", "الضفدع يبعد "..d.." متراً • الهروب يشتغل تحت "..DANGER_RADIUS.." متراً • التنبيه عند "..WARN_RADIUS.." متراً", 5)
    else
        NotifyMsg("info", "🧪 الفحص", "الضفدع لا يملك جسماً حالياً", 4)
    end
end)

AddToggle("🛡️ الهروب التلقائي من الضفدع", function(on)
    States.SelfEscape = on
    if on and not FrogPlayer then
        NotifyMsg("info", "⚠️ مهم!", "اختر الضفدع أولاً ليعمل الهروب", 6)
    else
        NotifyMsg("info", "🛡️ الهروب التلقائي", on and "نشط! يهرب لو قرّب "..DANGER_RADIUS.." متر" or "متوقف", 4)
    end
end, true)

AddPresetRow("🛡️ مسافة الهروب (متر)", {
    {label = "10م", value = 10},
    {label = "20م", value = 20},
    {label = "35م", value = 35},
    {label = "50م", value = 50},
    {label = "80م", value = 80},
}, function(v)
    DANGER_RADIUS = v
    NotifyMsg("info", "🛡️ مسافة الهروب", "أصبحت: "..v.." متراً", 2)
    print("[FroggeHub] 🛡️ مسافة الهروب الآن: "..v.."م")
end)

AddButton("🗑️ حذف اختيار الضفدع", Color3.fromRGB(80, 50, 50), function()
    FrogPlayer = nil
    FrogSelectBtn.Text = "🎯 اختر الضفدع (لاعب)"
    NotifyMsg("info", "🗑️ الحذف", "تم حذف اختيار الضفدع", 3)
end)

AddToggle("🚀 الانتقال التلقائي (واقف فوقه - بلا دمج)", function(on)
    States.AutoTP = on
    NotifyMsg("info", "🚀 الانتقال التلقائي", on and "نشط! تنتقل واقف فوق الساقط" or "متوقف", 4)
end, true)

AddToggle("💚 الإحياء التلقائي (استمرار E)", function(on)
    States.AutoRevive = on
    NotifyMsg("info", "💚 الإحياء التلقائي", on and "نشط!" or "متوقف", 4)
end, true)

AddToggle("🔘 الاندماج (داخل جسده - اختياري)", function(on)
    States.Underground = on
    if not on and followActive then StopFollow() end
    NotifyMsg("info", "🔘 الاندماج", on and "مفعل - راح تندمج بجسم الساقط" or "معطل - الانتقال واقف فوقه", 4)
end)

AddPresetRow("🔘 إزاحة الاندماج (لو مفعل)", {
    {label = "-1", value = -1},
    {label = "-0.5", value = -0.5},
    {label = "المنتصف", value = 0},
    {label = "+0.5", value = 0.5},
    {label = "+1", value = 1},
}, function(v)
    FOLLOW_OFFSET = v
    NotifyMsg("info", "🔘 الإزاحة", "أصبحت: "..v, 2)
end)

AddButton("🎯 انتقل الآن (واقف فوق الساقط)", Color3.fromRGB(38, 122, 72), function()
    ManualTeleport(true, false)
end)

local SpeedToggle = AddToggle("⚡ السرعة ["..SpeedValue.."]", function(on)
    States.Speed = on
    if not on then
        local character = LocalPlayer.Character
        local humanoid = character and character:FindFirstChildOfClass("Humanoid")
        if humanoid then humanoid.WalkSpeed = 16 end
    end
end)

AddPresetRow("⚡ تغيير السرعة (فعّل الزر فوق)", {
    {label = "16", value = 16},
    {label = "30", value = 30},
    {label = "50", value = 50},
    {label = "75", value = 75},
    {label = "100", value = 100},
}, function(v)
    SpeedValue = v
    SpeedToggle.SetText("⚡ السرعة ["..SpeedValue.."]")
    NotifyMsg("info", "⚡ السرعة", "أصبحت: "..SpeedValue, 2)
end)

AddToggle("🦘 القفز اللانهائي", function(on)
    States.InfJump = on
end)

AddToggle("🕊️ الطيران", function(on)
    States.Fly = on
    FlyUpBtn.Visible = on
    FlyDownBtn.Visible = on
    if on then
        if followActive then StopFollow() end
        StartFly()
    end
end)

AddToggle("👁️ الرؤية (الضفدع بنفسجي + الساقط أحمر)", function(on)
    States.ESP = on
    if not on then
        for _, plr in ipairs(Players:GetPlayers()) do
            CleanESP(plr)
        end
    end
end)

AddToggle("🛡️ منع الطرد (Anti-AFK)", function(on)
    States.AntiAFK = on
end)

AddToggle("💡 الإضاءة الكاملة", function(on)
    States.Fullbright = on
    pcall(SetFullbright, on)
end)

AddToggle("👻 عبور الجدران (Noclip)", function(on)
    States.Noclip = on
    if not on and not followActive then pcall(RestoreCollision) end
end)

AddButton("❌ إيقاف السكريبت نهائياً", Color3.fromRGB(150, 45, 50), function()
    for key in pairs(States) do States[key] = false end
    pcall(StopFollow)
    for _, plr in ipairs(Players:GetPlayers()) do
        CleanESP(plr)
    end
    pcall(function() SetFullbright(false) end)
    pcall(RestoreCollision)
    local character = LocalPlayer.Character
    local humanoid = character and character:FindFirstChildOfClass("Humanoid")
    if humanoid then pcall(function() humanoid.WalkSpeed = 16 end) end
    ScreenGui:Destroy()
    task.spawn(function()
        pcall(function()
            StarterGui:SetCore("SendNotification", {
                Title = "🐸 مركز الضفدع",
                Text = "تم إيقاف السكريبت بالكامل ✅",
                Duration = 4,
            })
        end)
    end)
end)

--═════════ 📜 سجل التحديثات (آخر شي) ═════════--
AddButton("📜 سجل التحديثات (آخر التحديثات)", Color3.fromRGB(50, 60, 100), function()
    local changelog = "📜 سجل التحديثات:\n\n"..
        "🆕 v19.3 (الحالية):\n"..
        "• 🛡️ الهروب: 10م (الضفدع لازم يقرّب جداً)\n"..
        "• التنبيه المسبق: 20م\n"..
        "• محرس الساقط: 8م (مو 18م - تنقذ بجنبه بسهولة)\n\n"..
        "v19.2:\n"..
        "• الانتقال: واقف فوق الساقط (بلا دمج)\n"..
        "• الاندماج: مطفي افتراضياً\n\n"..
        "v19.1:\n"..
        "• سجل التحديثات\n"..
        "• حذف زر نقطة الاختبار\n\n"..
        "v19.0:\n"..
        "• هروب محسّن + تنبيه مسبق\n"..
        "• الراوتر الذكي (تقرير شامل)\n"..
        "• اختصارات: H هروب، F تقرير\n\n"..
        "v18.2: منع الطيحة (5 طبقات)\n"..
        "v18.0: قفل متسامح + ميزات جاهزة\n"..
        "v17.0: كلمة السر\n"..
        "v16.0: نقاط جماعية\n"..
        "v15.0: ملف لكل حساب\n"..
        "v14.0: نظام المستويات\n"..
        "v13.0: إشعارات فصيحة\n"..
        "v12.0: هروب آمن لمسطح\n"..
        "v11.0: الضفدع = لاعب\n"..
        "v8.0-10.0: الاندماج + زر E"

    print(changelog)
    NotifyMsg("info", "📜 سجل التحديثات", "طُبع بالكامل بلوق دلتا 📋", 4)
end)

RefreshLevelUI()

--═════════ الزر العائم 🐸 ═════════--
local FloatingButton = Instance.new("TextButton")
FloatingButton.Size = UDim2.new(0, 50, 0, 50)
FloatingButton.Position = UDim2.new(0, 12, 0.35, 0)
FloatingButton.BackgroundColor3 = Color3.fromRGB(38, 122, 72)
FloatingButton.BorderSizePixel = 0
FloatingButton.Text = "🐸"
FloatingButton.TextSize = 28
FloatingButton.Font = Enum.Font.GothamBold
FloatingButton.ZIndex = 50
FloatingButton.Parent = ScreenGui

do
    local c = Instance.new("UICorner") c.CornerRadius = UDim.new(1, 0) c.Parent = FloatingButton
    local s = Instance.new("UIStroke") s.Color = Color3.fromRGB(85, 220, 130) s.Thickness = 2 s.Parent = FloatingButton
end

FloatingButton.MouseButton1Click:Connect(function()
    MainFrame.Visible = not MainFrame.Visible
end)

MinimizeButton.MouseButton1Click:Connect(function()
    MainFrame.Visible = false
    NotifyMsg("info", "🐸 مركز الضفدع", "اضغط 🐸 لإظهار القائمة", 3)
end)

--═════════ ⌨️ الاختصارات ═════════--
UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    if input.KeyCode == REVIVE_KEY then
        if not IsReviving then
            ManualTeleport(true, true)
        end
    elseif input.KeyCode == Enum.KeyCode.K then
        MainFrame.Visible = not MainFrame.Visible
    elseif input.KeyCode == Enum.KeyCode.H then
        local myChar = LocalPlayer.Character
        local myRoot = myChar and myChar:FindFirstChild("HumanoidRootPart")
        if myRoot then
            local escaped = EscapeFromFrog()
            NotifyMsg("info", "🛡️ هروب يدوي", escaped and "تم! جرّب تتقرب من الضفدع وشاهد الحماية" or "ما فيه ضفدع محدد أو مكان آمن", 4)
        end
    elseif input.KeyCode == Enum.KeyCode.F then
        local fRoot = GetFrogRoot()
        local frogDist = 0
        if fRoot then
            local myChar = LocalPlayer.Character
            local myRoot = myChar and myChar:FindFirstChild("HumanoidRootPart")
            if myRoot then
                frogDist = math.floor((fRoot.Position - myRoot.Position).Magnitude)
            end
        end
        local downedCount = 0
        for _, plr in ipairs(Players:GetPlayers()) do
            if plr ~= LocalPlayer and GetDownedInfo(plr) then
                downedCount = downedCount + 1
            end
        end
        NotifyMsg("info", "📊 سريع", "Lv "..MyLevel.." • هروبات: "..Stats.escapes.." • إنقاذات: "..Stats.rescues.." • ساقطين: "..downedCount.." • ضفدع: "..frogDist.."م", 5)
    end
end)

--═════════ ⭐ محدث الشعارات ═════════--
LocalPlayer.CharacterAdded:Connect(function(char)
    task.wait(1)
    pcall(UpdateMyBadge)
end)

Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function()
        task.wait(1)
        pcall(UpdateOthersBadges)
    end)
end)

task.spawn(function()
    while ScreenGui.Parent do
        task.wait(1)
        pcall(UpdateMyBadge)
        pcall(UpdateOthersBadges)
        pcall(function()
            local myChar = LocalPlayer.Character
            local myRoot = myChar and myChar:FindFirstChild("HumanoidRootPart")
            local myHum = myChar and myChar:FindFirstChildOfClass("Humanoid")
            if myRoot and myHum and myHum.Health > 0 and not followActive then
                local fRoot = GetFrogRoot()
                if fRoot and (fRoot.Position - myRoot.Position).Magnitude > DANGER_RADIUS + 30 then
                    local ok, hit = pcall(function()
                        return Workspace:Raycast(myRoot.Position, Vector3.new(0, -8, 0), GetRayParams())
                    end)
                    if ok and hit then
                        lastSafePos = hit.Position + Vector3.new(0, 3.5, 0)
                    end
                end
            end
        end)
    end
end)

NotifyMsg("info", "🐸 مركز الضفدع v19.3", "تم التشغيل! أهلاً "..LocalPlayer.Name.." 🎉 • Lv "..MyLevel, 5)
NotifyMsg("info", "🛡️ الهروب الجديد", "يهرب بك فقط لو الضفدع قرّب 10 أمتار!", 7)
NotifyMsg("info", "⌨️ الاختصارات", "E = انتقال • K = قائمة • H = هروب فوري • F = تقرير", 8)

print("🐸 مركز الضفدع v19.3 - اكتمل التحميل بنجاح! ✅")
print("🛡️ الهروب: 10م فقط (الضفدع لازم يقرّب جداً) | التنبيه: 20م")

end -- نهاية StartMainScript

print("🔐 السكريبت جاهز - بانتظار كلمة السر...")

Features & Information

Auto assistant helps injured players Me Username: romal3m607 Own: romal Note there is a password in the script and you can find it in the script in a specific place the first person to find it will get the VIP copy
#Frogge romal roblox

Community Comments (0)

No comments yet for this script.