Rayfield = loadstring(game:HttpGet('https://[Log in to view URL]'))()

local sound = Instance.new("Sound")
sound.Parent = workspace
sound.SoundId = "rbxassetid://6958727243"
sound.Volume = 100
sound.PlaybackSpeed = 0.5
sound.TimePosition = -1
sound.Playing = true



local LoadingScreen = Instance.new("ScreenGui")
LoadingScreen.Name = "LoadingScreen"
LoadingScreen.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")


local Main = Instance.new("Frame")
Main.Name = "Main"
Main.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
Main.BorderSizePixel = 0
Main.Position = UDim2.new(0.5, -250, 0.5, -135)
Main.Size = UDim2.new(0, 500, 0, 270)
Main.Parent = LoadingScreen

Main.BackgroundTransparency = 1  -- This makes the grey box completely invisible


local Main = Instance.new("Frame")
Main.Name = "Main"
Main.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
Main.BorderSizePixel = 0
Main.Position = UDim2.new(0.5, -500, 0.5, -200) -- Adjusted position for larger size
Main.Size = UDim2.new(0, 1000, 0, 400) -- Made wider and taller
Main.Parent = LoadingScreen

local LoadingText = Instance.new("TextLabel")
LoadingText.Name = "LoadingText"
LoadingText.BackgroundTransparency = 1
LoadingText.Position = UDim2.new(0, 0, 0, 60)
LoadingText.Size = UDim2.new(1, 0, 0, 250) -- Made taller
LoadingText.Font = Enum.Font.Code
LoadingText.Text = [[
 __  __     __     __   __     ______        __    __     ______     _____     ______        ______   __  __     __     ______    
/\ \/ /    /\ \   /\ "-.\ \   /\  ___\      /\ "-./  \   /\  __ \   /\  __-.  /\  ___\      /\__  _\ /\ \_\ \   /\ \   /\  ___\   
\ \  _"-.  \ \ \  \ \ \-.  \  \ \ \__ \     \ \ \-./\ \  \ \  __ \  \ \ \/\ \ \ \  __\      \/_/\ \/ \ \  __ \  \ \ \  \ \___  \  
 \ \_\ \_\  \ \_\  \ \_\\"\_\  \ \_____\     \ \_\ \ \_\  \ \_\ \_\  \ \____-  \ \_____\       \ \_\  \ \_\ \_\  \ \_\  \/\_____\ 
  \/_/\/_/   \/_/   \/_/ \/_/   \/_____/      \/_/  \/_/   \/_/\/_/   \/____/   \/_____/        \/_/   \/_/\/_/   \/_/   \/_____/]]
LoadingText.TextColor3 = Color3.fromRGB(147, 112, 219)
LoadingText.TextSize = 14 -- Increased text size for better visibility
LoadingText.Parent = Main

local DiscordInvite = Instance.new("TextLabel")
DiscordInvite.Name = "DiscordInvite"
DiscordInvite.BackgroundTransparency = 1
DiscordInvite.Position = UDim2.new(0, 0, 0, 320) -- Adjusted position
DiscordInvite.Size = UDim2.new(1, 0, 0, 30)
DiscordInvite.Font = Enum.Font.GothamBold
DiscordInvite.Text = "discord.gg/3Jv4bzKP"
DiscordInvite.TextColor3 = Color3.fromRGB(114, 137, 218)
DiscordInvite.TextSize = 30
DiscordInvite.Parent = Main


-- Add your loading logic here
wait(2) -- Example wait time
LoadingScreen:Destroy()


-- Create window with synchronized timing
local Window = Rayfield:CreateWindow({
    Name = "Kings Script",
    LoadingTitle = "All Gui Script",
    LoadingSubtitle = "(by King)",
    Theme = "Dark",
    ConfigurationSaving = {
        Enabled = true,
        FolderName = nil,
        FileName = "Kings script gui"
            
    }
})


-- ESP Variables and Functions
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Visuals = {Players = {}}



-- Drawing Properties - Modified to all white
local DrawingProperties = {
    Square = {
        Thickness = 2,
        Filled = false,
        Color = Color3.fromRGB(255, 255, 255), -- Pure white
        Visible = false,
        Transparency = 1
    }
}

-- ESP Functions
function Visuals:Round(Number, Bracket)
    Bracket = (Bracket or 1)
    if typeof(Number) == "Vector2" then
        return Vector2.new(Visuals:Round(Number.X), Visuals:Round(Number.Y))
    else
        return (Number - Number % (Bracket or 1))
    end
end

function Visuals:GetScreenPosition(Position)
    local Position, Visible = workspace.CurrentCamera:WorldToViewportPoint(Position)
    return Vector2.new(Position.X, Position.Y), Visible, Position
end

function Visuals:CreateDrawing(Type, Custom)
    local Drawing = Drawing.new(Type)
    for Property, Value in pairs(DrawingProperties[Type]) do
        Drawing[Property] = Value
    end
    if Custom then
        for Property, Value in pairs(Custom) do
            Drawing[Property] = Value
        end
    end
    return Drawing
end

-- ESP Player Management
function Visuals.AddPlayer(Player)
    if not Visuals.Players[Player] then
        Visuals.Players[Player] = {
            Boxes = {},
            LastParts = {}
        }
    end
end

function Visuals.RemovePlayer(Player)
    if Visuals.Players[Player] then
        for _, Drawing in pairs(Visuals.Players[Player].Boxes) do
            if Drawing.Main then Drawing.Main:Remove() end
            if Drawing.Outline then Drawing.Outline:Remove() end
        end
        Visuals.Players[Player] = nil
    end
end

-- Player Utility Functions
local PlayerUtilities = {}

function PlayerUtilities:IsPlayerAlive(Player)
    local Character = Player.Character
    local Humanoid = Character and Character:FindFirstChildWhichIsA("Humanoid")
    return Character and Humanoid and Humanoid.Health > 0
end

-- ESP Toggle State
local ESPEnabled = false

-- Create Tabs
local MainTab = Window:CreateTab("Home", nil)
local MainSection = MainTab:CreateSection("Main")
local MainSection = MainTab:CreateSection("Main")

-- Create Menu Status Label
local MenuStatusLabel = MainTab:CreateLabel("Menu Status: Checking...")

-- Function to check menu components
local function CheckMenuStatus()
    local menuComponents = {
        UserInputService = game:GetService("UserInputService"),
        RunService = game:GetService("RunService"),
        Players = game:GetService("Players"),
        Character = game.Players.LocalPlayer.Character,
    }
    
    -- Check if all components are available
    local allValid = true
    local missingComponents = {}
    
    for name, component in pairs(menuComponents) do
        if not component then
            allValid = false
            table.insert(missingComponents, name)
        end
    end
    
    -- Additional character component checks
    if menuComponents.Character then
        local requiredParts = {"HumanoidRootPart", "Humanoid", "Head"}
        for _, part in ipairs(requiredParts) do
            if not menuComponents.Character:FindFirstChild(part) then
                allValid = false
                table.insert(missingComponents, "Character:" .. part)
            end
        end
    end
    
    -- Update status label with appropriate check mark or X
    if allValid then
        MenuStatusLabel:Set("Menu Status: Working ✅")
        Rayfield:Notify({
            Title = "Menu Status",
            Content = "All menu components are working properly!",
            Duration = 6.5,
            Image = nil,
            Actions = {
                Ignore = {
                    Name = "Okay!",
                    Callback = function()
                        print("Menu status check completed successfully")
                    end
                },
            },
        })
    else
        MenuStatusLabel:Set("Menu Status: Error ❌")
        local errorMsg = "Missing components: " .. table.concat(missingComponents, ", ")
        Rayfield:Notify({
            Title = "Menu Status Error",
            Content = errorMsg,
            Duration = 6.5,
            Image = nil,
            Actions = {
                Ignore = {
                    Name = "Got it",
                    Callback = function()
                        print("Menu status check failed: " .. errorMsg)
                    end
                },
            },
        })
    end
end

-- Create Check Menu Status button
local CheckMenuButton = MainTab:CreateButton({
    Name = "Check Menu Status",
    Callback = function()
        MenuStatusLabel:Set("Menu Status: Checking...")
        task.wait(0.5) -- Short delay for visual feedback
        CheckMenuStatus()
    end
})

-- Run initial check when script loads
task.spawn(function()
    task.wait(1) -- Wait for everything to load
    CheckMenuStatus()
end)



local FriendsOnline = 0

-- Count online friends
for _, friend in pairs(LocalPlayer:GetFriendsOnline()) do
    FriendsOnline = FriendsOnline + 1
end

-- Add this right after your Window creation
local FriendsLabel = MainTab:CreateLabel("Friends Online: " .. FriendsOnline)

-- Auto-update the counter every 5 seconds
coroutine.wrap(function()
    while task.wait(5) do
        local NewCount = 0
        for _, friend in pairs(LocalPlayer:GetFriendsOnline()) do
            NewCount = NewCount + 1
        end
        FriendsOnline = NewCount
        FriendsLabel:Set("Friends Online: " .. FriendsOnline)
    end
end)()

-- Add this to track friends joining
Players.PlayerAdded:Connect(function(player)
    if LocalPlayer:IsFriendsWith(player.UserId) then
        Rayfield:Notify({
            Title = "Friend Joined!",
            Content = player.Name .. " has joined your server!",
            Duration = 10.,
            Image = nil,
            Actions = {
                Ignore = {
                    Name = "Cool!",
                    Callback = function()
                        print("Friend joined: " .. player.Name)
                    end
                },
            },
        })
    end
end)

-- Add this to track friends already in server
for _, player in pairs(Players:GetPlayers()) do
    if player ~= LocalPlayer and LocalPlayer:IsFriendsWith(player.UserId) then
        Rayfield:Notify({
            Title = "Friend In Server!",
            Content = player.Name .. " is currently in your server!",
            Duration = 6.5,
            Image = nil,
            Actions = {
                Ignore = {
                    Name = "Nice!",
                    Callback = function()
                        print("Friend in server: " .. player.Name)
                    end
                },
            },
        })
    end
end

local function countFriendsInServer()
    local friendCount = 0
    for _, player in pairs(Players:GetPlayers()) do
        if player ~= LocalPlayer and LocalPlayer:IsFriendsWith(player.UserId) then
            friendCount = friendCount + 1
        end
    end
    return friendCount
end

local FriendsInServerLabel = MainTab:CreateLabel("Friends in Server: " .. countFriendsInServer())

-- Auto-update the counter
Players.PlayerAdded:Connect(function()
    FriendsInServerLabel:Set("Friends in Server: " .. countFriendsInServer())
end)

Players.PlayerRemoving:Connect(function()
    FriendsInServerLabel:Set("Friends in Server: " .. countFriendsInServer())
end)

local Tab = Window:CreateTab("nil", nil) -- Title, Image

-- Destroy existing ReticleGui if it exists
for _, gui in pairs(game.Players.LocalPlayer.PlayerGui:GetChildren()) do
    if gui.Name == "ReticleGui" then
        gui:Destroy()
    end
end

-- Create Reticle GUI
local ReticleGui = Instance.new("ScreenGui")
ReticleGui.Name = "ReticleGui"
ReticleGui.Parent = game.Players.LocalPlayer.PlayerGui

-- Create Reticle Frame
local ReticleFrame = Instance.new("Frame")
ReticleFrame.Name = "Reticle"
ReticleFrame.BackgroundTransparency = 1
ReticleFrame.Size = UDim2.new(1, 0, 1, 0)
ReticleFrame.Position = UDim2.new(0, 0, 0, 0)
ReticleFrame.Parent = ReticleGui

-- Reticle Presets
local ReticlePresets = {
    Default = {
        Color = Color3.fromRGB(255, 0, 0),
        Size = 10
    },
    Green = {
        Color = Color3.fromRGB(0, 255, 0),
        Size = 8
    },
    Blue = {
        Color = Color3.fromRGB(0, 0, 255),
        Size = 12
    }
}

-- Create Cross Reticle
local function createCrossReticle(preset)
    -- Clear existing reticle
    for _, v in pairs(ReticleFrame:GetChildren()) do
        v:Destroy()
    end

    local color = preset.Color
    local size = preset.Size

    -- Top Line
    local TopLine = Instance.new("Frame")
    TopLine.Name = "TopLine"
    TopLine.BackgroundColor3 = color
    TopLine.Size = UDim2.new(0, 2, 0, size)
    TopLine.Position = UDim2.new(0.5, -1, 0.5, -size)
    TopLine.BorderSizePixel = 0
    TopLine.Parent = ReticleFrame

    -- Bottom Line (slightly longer)
    local BottomLine = Instance.new("Frame")
    BottomLine.Name = "BottomLine"
    BottomLine.BackgroundColor3 = color
    BottomLine.Size = UDim2.new(0, 2, 0, size * 1.5)
    BottomLine.Position = UDim2.new(0.5, -1, 0.5, 0)
    BottomLine.BorderSizePixel = 0
    BottomLine.Parent = ReticleFrame

    -- Left Line
    local LeftLine = Instance.new("Frame")
    LeftLine.Name = "LeftLine"
    LeftLine.BackgroundColor3 = color
    LeftLine.Size = UDim2.new(0, size, 0, 2)
    LeftLine.Position = UDim2.new(0.5, -size, 0.5, -1)
    LeftLine.BorderSizePixel = 0
    LeftLine.Parent = ReticleFrame

    -- Right Line
    local RightLine = Instance.new("Frame")
    RightLine.Name = "RightLine"
    RightLine.BackgroundColor3 = color
    RightLine.Size = UDim2.new(0, size, 0, 2)
    RightLine.Position = UDim2.new(0.5, 0, 0.5, -1)
    RightLine.BorderSizePixel = 0
    RightLine.Parent = ReticleFrame

    return {TopLine, BottomLine, LeftLine, RightLine}
end

-- Initial reticle creation
local currentReticleLines = createCrossReticle(ReticlePresets.Default)
local currentPreset = "Default"

-- Visibility Toggle
local ToggleReticle = Tab:CreateToggle({
    Name = "Reticle Visibility",
    CurrentValue = true,
    Flag = "ReticleToggle",
    Callback = function(Value)
        ReticleFrame.Visible = Value
    end
})

-- Preset Dropdown (Simplified)
local PresetDropdown = Tab:CreateDropdown({
    Name = "Reticle Preset",
    Options = {"Default", "Green", "Blue"},
    CurrentOption = "Default",
    Flag = "ReticlePreset",
    Callback = function(Option)
        -- Ensure the option exists in presets
        if ReticlePresets[Option] then
            currentReticleLines = createCrossReticle(ReticlePresets[Option])
            currentPreset = Option
        end
    end
})

-- Color Sliders
local RedSlider = Tab:CreateSlider({
   Name = "Reticle Red",
   Range = {0, 255},
   Increment = 1,
   Suffix = "R",
   CurrentValue = 255,
   Flag = "ReticleRed",
   Callback = function(Value)
      local currentColor = currentReticleLines[1].BackgroundColor3
      local newColor = Color3.fromRGB(Value, currentColor.G * 255, currentColor.B * 255)
      
      for _, line in ipairs(currentReticleLines) do
         line.BackgroundColor3 = newColor
      end
      
      -- Update current preset
      ReticlePresets[currentPreset].Color = newColor
   end
})

-- Green Slider
local GreenSlider = Tab:CreateSlider({
   Name = "Reticle Green",
   Range = {0, 255},
   Increment = 1,
   Suffix = "G",
   CurrentValue = 0,
   Flag = "ReticleGreen",
   Callback = function(Value)
      local currentColor = currentReticleLines[1].BackgroundColor3
      local newColor = Color3.fromRGB(currentColor.R * 255, Value, currentColor.B * 255)
      
      for _, line in ipairs(currentReticleLines) do
         line.BackgroundColor3 = newColor
      end
      
      -- Update current preset
      ReticlePresets[currentPreset].Color = newColor
   end
})

-- Blue Slider
local BlueSlider = Tab:CreateSlider({
   Name = "Reticle Blue",
   Range = {0, 255},
   Increment = 1,
   Suffix = "B",
   CurrentValue = 0,
   Flag = "ReticleBlue",
   Callback = function(Value)
      local currentColor = currentReticleLines[1].BackgroundColor3
      local newColor = Color3.fromRGB(currentColor.R * 255, currentColor.G * 255, Value)
      
      for _, line in ipairs(currentReticleLines) do
         line.BackgroundColor3 = newColor
      end
      
      -- Update current preset
      ReticlePresets[currentPreset].Color = newColor
   end
})

-- Size Slider
local SizeSlider = Tab:CreateSlider({
   Name = "Reticle Size",
   Range = {1, 10},
   Increment = 1,
   Suffix = "Size",
   CurrentValue = 5,
   Flag = "ReticleSize",
   Callback = function(Value)
      local size = Value * 2
      
      for i, line in ipairs(currentReticleLines) do
         if i == 1 then  -- Top
            line.Size = UDim2.new(0, 2, 0, size)
            line.Position = UDim2.new(0.5, -1, 0.5, -size)
         elseif i == 2 then  -- Bottom (longer)
            line.Size = UDim2.new(0, 2, 0, size * 1.5)
            line.Position = UDim2.new(0.5, -1, 0.5, 0)
         elseif i == 3 then  -- Left
            line.Size = UDim2.new(0, size, 0, 2)
            line.Position = UDim2.new(0.5, -size, 0.5, -1)
         elseif i == 4 then  -- Right
            line.Size = UDim2.new(0, size, 0, 2)
            line.Position = UDim2.new(0.5, 0, 0.5, -1)
         end
      end
      
      -- Update current preset size
      ReticlePresets[currentPreset].Size = size
   end
})

-- Initial setup
RedSlider:Set(255)
GreenSlider:Set(0)
BlueSlider:Set(0)
SizeSlider:Set(5)




-- Players Tab with ESP Toggle
local Tab = Window:CreateTab("Miscs", nil)
local Section = Tab:CreateSection("Self")

local Button = Tab:CreateButton({
   Name = "Fling All",
   Callback = function()
local Targets = {"All"}
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local AllBool = false

local GetPlayer = function(Name)
    Name = Name:lower()
    if Name == "all" or Name == "others" then
        AllBool = true
        return
    elseif Name == "random" then
        local GetPlayers = Players:GetPlayers()
        if table.find(GetPlayers,Player) then table.remove(GetPlayers,table.find(GetPlayers,Player)) end
        return GetPlayers[math.random(#GetPlayers)]
    elseif Name ~= "random" and Name ~= "all" and Name ~= "others" then
        for _,x in next, Players:GetPlayers() do
            if x ~= Player then
                if x.Name:lower():match("^"..Name) then
                    return x;
                elseif x.DisplayName:lower():match("^"..Name) then
                    return x;
                end
            end
        end
    else
        return
    end
end

local SkidFling = function(TargetPlayer)
    local Character = Player.Character
    local Humanoid = Character and Character:FindFirstChildOfClass("Humanoid")
    local RootPart = Humanoid and Humanoid.RootPart

    local TCharacter = TargetPlayer.Character
    local THumanoid = TCharacter:FindFirstChildOfClass("Humanoid")
    local TRootPart = THumanoid and THumanoid.RootPart
    local THead = TCharacter:FindFirstChild("Head")
    local Accessory = TCharacter:FindFirstChildOfClass("Accessory")
    local Handle = Accessory and Accessory:FindFirstChild("Handle")

    if Character and Humanoid and RootPart then
        if RootPart.Velocity.Magnitude < 50 then
            getgenv().OldPos = RootPart.CFrame
        end
        
        local FPos = function(BasePart, Pos, Ang)
            RootPart.CFrame = CFrame.new(BasePart.Position) * Pos * Ang
            Character:SetPrimaryPartCFrame(CFrame.new(BasePart.Position) * Pos * Ang)
            RootPart.Velocity = Vector3.new(9e7, 9e7 * 10, 9e7)
            RootPart.RotVelocity = Vector3.new(9e8, 9e8, 9e8)
        end
        
        local SFBasePart = function(BasePart)
            local TimeToWait = 2
            local Time = tick()
            local Angle = 0

            repeat
                if RootPart and THumanoid then
                    if BasePart.Velocity.Magnitude < 50 then
                        Angle = Angle + 100
                        FPos(BasePart, CFrame.new(0, 1.5, 0) + THumanoid.MoveDirection * BasePart.Velocity.Magnitude / 1.25, CFrame.Angles(math.rad(Angle),0 ,0))
                        task.wait()
                    else
                        FPos(BasePart, CFrame.new(0, 1.5, THumanoid.WalkSpeed), CFrame.Angles(math.rad(90), 0, 0))
                        task.wait()
                    end
                else
                    break
                end
            until BasePart.Velocity.Magnitude > 500 or tick() > Time + TimeToWait
        end
        
        workspace.FallenPartsDestroyHeight = 0/0
        
        local BV = Instance.new("BodyVelocity")
        BV.Name = "EpixVel"
        BV.Parent = RootPart
        BV.Velocity = Vector3.new(9e8, 9e8, 9e8)
        BV.MaxForce = Vector3.new(1/0, 1/0, 1/0)
        
        Humanoid:SetStateEnabled(Enum.HumanoidStateType.Seated, false)
        
        if TRootPart and THead then
            if (TRootPart.CFrame.p - THead.CFrame.p).Magnitude > 5 then
                SFBasePart(THead)
            else
                SFBasePart(TRootPart)
            end
        elseif TRootPart then
            SFBasePart(TRootPart)
        elseif THead then
            SFBasePart(THead)
        elseif Handle then
            SFBasePart(Handle)
        end
        
        BV:Destroy()
        Humanoid:SetStateEnabled(Enum.HumanoidStateType.Seated, true)
        
        repeat
            RootPart.CFrame = getgenv().OldPos * CFrame.new(0, .5, 0)
            Character:SetPrimaryPartCFrame(getgenv().OldPos * CFrame.new(0, .5, 0))
            Humanoid:ChangeState("GettingUp")
            task.wait()
        until (RootPart.Position - getgenv().OldPos.p).Magnitude < 25
    end
end

if Targets[1] then for _,x in next, Targets do GetPlayer(x) end end

if AllBool then
    for _,x in next, Players:GetPlayers() do
        if x ~= Player then
            SkidFling(x)
        end
    end
end

for _,x in next, Targets do
    if GetPlayer(x) and GetPlayer(x) ~= Player then
        if GetPlayer(x).UserId ~= 890009924 then
            local TPlayer = GetPlayer(x)
            if TPlayer then
                SkidFling(TPlayer)
            end
        end
    end
end

   end,
})


local Toggle = Tab:CreateToggle({
    Name = "Hold Infinite Jump",
    CurrentValue = false,
    Flag = "HoldJump",
    Callback = function(Value)
        _G.holdInfJump = Value
        
        if _G.holdJumpStarted == nil then
            _G.holdJumpStarted = false
            
            -- Setup the hold jump functionality
            game:GetService("UserInputService").InputBegan:Connect(function(input, gameProcessed)
                if _G.holdInfJump and input.KeyCode == Enum.KeyCode.Space then
                    while _G.holdInfJump and input.KeyCode == Enum.KeyCode.Space and 
                          game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.Space) do
                        local humanoid = game:GetService('Players').LocalPlayer.Character:FindFirstChildOfClass('Humanoid')
                        if humanoid then
                            humanoid:ChangeState('Jumping')
                        end
                        task.wait()
                    end
                end
            end)
        end
    end,
})
local Slider = Tab:CreateSlider({
    Name = "Jump Distance",
    Range = {50, 500},
    Increment = 10,
    Suffix = "studs",
    CurrentValue = 50,
    Flag = "JumpDistance",
    Callback = function(Value)
        local player = game:GetService('Players').LocalPlayer
        if player.Character and player.Character:FindFirstChild('Humanoid') then
            player.Character.Humanoid.JumpPower = Value
        end
    end,
})
local Button = Tab:CreateButton({
    Name = "Drop to Floor",
    Callback = function()
        local player = game:GetService('Players').LocalPlayer
        local character = player.Character
        
        task.spawn(function()
            if character then
                local humanoid = character:FindFirstChild('Humanoid')
                local rootPart = character:FindFirstChild('HumanoidRootPart')
                if humanoid and rootPart then
                    rootPart.Velocity = Vector3.new(0, 0, 0)
                    local currentPos = rootPart.Position
                    rootPart.CFrame = CFrame.new(currentPos.X, 0, currentPos.Z)
                    task.wait()
                    rootPart.CFrame = CFrame.new(currentPos.X, 3, currentPos.Z)
                end
            end
        end)
    end
})


-- Walkspeed Slider
local Slider = Tab:CreateSlider({
   Name = "Walkspeed Slider",
   Range = {0, 500},
   Increment = 1,
   Suffix = "Speed",
   CurrentValue = 16,
   Flag = "example",
   Callback = function(Value)
      if Value == 0 then
         game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
      else
         game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = Value
      end
   end,
})



local Toggle = Tab:CreateToggle({
    Name = "Toggle Spin",
    CurrentValue = false,
    Flag = "SpinEnabled",
    Callback = function(Value)
        local character = game.Players.LocalPlayer.Character
        if character then
            if Value then
                local spinForce = Instance.new("BodyAngularVelocity")
                spinForce.Name = "SpinForce"
                spinForce.AngularVelocity = Vector3.new(0, 50, 0)
                spinForce.MaxTorque = Vector3.new(0, math.huge, 0)
                spinForce.Parent = character.HumanoidRootPart
            else
                local spinForce = character.HumanoidRootPart:FindFirstChild("SpinForce")
                if spinForce then spinForce:Destroy() end
            end
        end
    end
})

local Slider = Tab:CreateSlider({
    Name = "Spin Speed",
    Range = {1, 1000},
    Increment = 1,
    Suffix = "Speed",
    CurrentValue = 50,
    Flag = "SpinSpeed",
    Callback = function(Value)
        local character = game.Players.LocalPlayer.Character
        if character then
            local spinForce = character.HumanoidRootPart:FindFirstChild("SpinForce")
            if spinForce then
                spinForce.AngularVelocity = Vector3.new(0, Value, 0)
            end
        end
    end,
})



local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer

-- No Recoil Variables
local noRecoilEnabled = false

-- Create the toggle in your UI
local NoRecoilToggle = Tab:CreateToggle({
    Name = "No Recoil",
    Default = false,
    Callback = function(Value)
        noRecoilEnabled = Value
        
        if noRecoilEnabled then
            RunService.RenderStepped:Connect(function()
                if LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("Humanoid") then
                    -- Find all weapons/tools that might have recoil
                    for _, tool in pairs(LocalPlayer.Character:GetChildren()) do
                        if tool:IsA("Tool") then
                            -- Handle different recoil properties
                            if tool:FindFirstChild("Recoil") then
                                tool.Recoil.Value = 0
                            end
                            if tool:FindFirstChild("RecoilMult") then
                                tool.RecoilMult.Value = 0
                            end
                            if tool:FindFirstChild("SpreadMult") then
                                tool.SpreadMult.Value = 0
                            end
                            -- Handle recoil in weapon settings
                            if tool:FindFirstChild("Settings") then
                                local settings = tool.Settings
                                if settings:FindFirstChild("RecoilMin") then
                                    settings.RecoilMin.Value = 0
                                end
                                if settings:FindFirstChild("RecoilMax") then
                                    settings.RecoilMax.Value = 0
                                end
                            end
                        end
                    end
                end
            end)
        end
    end
})




local Toggle = Tab:CreateToggle({
   Name = "ESP",
   CurrentValue = false,
   Flag = "Toggle1",
   Callback = function(Value)
      ESPEnabled = Value
   end,
})

-- Initialize ESP
for _, Player in pairs(Players:GetPlayers()) do
    if Player ~= LocalPlayer then
        Visuals.AddPlayer(Player)
    end
end

Players.PlayerAdded:Connect(function(Player)
    Visuals.AddPlayer(Player)
end)

Players.PlayerRemoving:Connect(function(Player)
    Visuals.RemovePlayer(Player)
end)

-- ESP Update Loop
RunService.RenderStepped:Connect(function()
    for _, Player in pairs(Players:GetPlayers()) do
        if Player == LocalPlayer then continue end
        
        local Objects = Visuals.Players[Player]
        if not Objects then continue end

        if ESPEnabled and PlayerUtilities:IsPlayerAlive(Player) then
            local Character = Player.Character
            if not Character then continue end
            
            local CurrentParts = {}
            for _, Part in ipairs(Character:GetDescendants()) do
                if Part:IsA("BasePart") then
                    CurrentParts[Part] = true
                    
                    if not Objects.Boxes[Part] then
                        Objects.Boxes[Part] = {
                            Main = Visuals:CreateDrawing("Square", {
                                Color = Color3.fromRGB(255, 255, 255),
                                Thickness = 1
                            }),
                            Outline = Visuals:CreateDrawing("Square", {
                                Color = Color3.fromRGB(255, 255, 255),
                                Thickness = 2
                            })
                        }
                    end
                    
                    local ScreenPosition, OnScreen = Visuals:GetScreenPosition(Part.Position)
                    
                    if OnScreen then
                        local PartSize = Part.Size
                        local Height = (workspace.CurrentCamera.CFrame - workspace.CurrentCamera.CFrame.Position) * Vector3.new(0, PartSize.Y/2, 0)
                        Height = math.abs(workspace.CurrentCamera:WorldToScreenPoint(Part.Position + Height).Y - workspace.CurrentCamera:WorldToScreenPoint(Part.Position - Height).Y)
                        local Width = Height * (PartSize.X/PartSize.Y)
                        
                        local Size = Visuals:Round(Vector2.new(Width, Height))
                        local Position = Visuals:Round(Vector2.new(ScreenPosition.X, ScreenPosition.Y) - (Size / 2))

                        Objects.Boxes[Part].Outline.Size = Size
                        Objects.Boxes[Part].Outline.Position = Position
                        Objects.Boxes[Part].Outline.Visible = true

                        Objects.Boxes[Part].Main.Size = Size
                        Objects.Boxes[Part].Main.Position = Position
                        Objects.Boxes[Part].Main.Visible = true
                    else
                        Objects.Boxes[Part].Main.Visible = false
                        Objects.Boxes[Part].Outline.Visible = false
                    end
                end
            end
            
            for Part, Box in pairs(Objects.Boxes) do
                if not CurrentParts[Part] then
                    Box.Main:Remove()
                    Box.Outline:Remove()
                    Objects.Boxes[Part] = nil
                end
            end
        else
            for _, Box in pairs(Objects.Boxes) do
                Box.Main.Visible = false
                Box.Outline.Visible = false
            end
        end
    end
end)

-- Aimbot Variables
local aimbotEnabled = false
local FOVring = nil
local reticle = nil
local sensitivity = 2
local lastRenderStep = nil

-- Helper Functions
local function isTeammate(player)
    local localPlayer = game.Players.LocalPlayer
    if player.Team and localPlayer.Team then
        return player.Team == localPlayer.Team
    end
    return false
end

local function isTargetVisible(target)
    if not target or not target.Character then return false end
    
    local origin = workspace.CurrentCamera.CFrame.Position
    local direction = (target.Character.Head.Position - origin).Unit
    local distance = (target.Character.Head.Position - origin).Magnitude
    
    local ray = Ray.new(origin, direction * distance)
    local ignoreList = {game.Players.LocalPlayer.Character, target.Character}
    local hit = workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)
    
    return hit == nil
end

local function getClosest(cframe)
    local ray = Ray.new(cframe.Position, cframe.LookVector).Unit
    local target = nil
    local mag = math.huge

    for _, v in pairs(game.Players:GetPlayers()) do
        if v.Character 
            and v.Character:FindFirstChild("Head") 
            and v.Character:FindFirstChild("Humanoid") 
            and v.Character:FindFirstChild("HumanoidRootPart") 
            and v ~= game.Players.LocalPlayer 
            and not isTeammate(v) then
            
            local magBuf = (v.Character.Head.Position - ray:ClosestPoint(v.Character.Head.Position)).Magnitude
            if magBuf < mag then
                mag = magBuf
                target = v
            end
        end
    end
    return target
end

local function updateRGBColor()
    if not FOVring then return end
    local time = tick() * 0.5
    local r = math.abs(math.sin(time * 2)) * 255
    local g = math.abs(math.sin(time * 2 + math.pi / 2)) * 255
    local b = math.abs(math.sin(time * 2 + math.pi)) * 255
    FOVring.Color = Color3.fromRGB(r, g, b)
end

local function ToggleAimBot()
    aimbotEnabled = not aimbotEnabled

    if aimbotEnabled then
        if not FOVring then
            FOVring = Drawing.new("Circle")
            FOVring.Thickness = 1.5
            FOVring.Radius = 150
            FOVring.Transparency = 1
            FOVring.Position = workspace.CurrentCamera.ViewportSize / 2
        end
        FOVring.Visible = true

        if not reticle then
            reticle = Drawing.new("Circle")
            reticle.Radius = 30
            reticle.Transparency = 1
            reticle.Position = workspace.CurrentCamera.ViewportSize / 2
            reticle.Color = Color3.fromRGB(57, 255, 20)
        end
        reticle.Visible = true

        -- Disconnect previous connection if it exists
        if lastRenderStep then
            lastRenderStep:Disconnect()
        end

        -- Create new connection
        lastRenderStep = RunService.RenderStepped:Connect(function()
            if not aimbotEnabled then return end
            
            local cam = workspace.CurrentCamera
            local zz = cam.ViewportSize / 2
            local curTar = getClosest(cam.CFrame)
            
            if curTar then
                local visible = isTargetVisible(curTar)
                FOVring.Color = visible and Color3.fromRGB(0, 255, 0) or Color3.fromRGB(255, 0, 0)
                
                local ssHeadPoint = cam:WorldToScreenPoint(curTar.Character.Head.Position)
                ssHeadPoint = Vector2.new(ssHeadPoint.X, ssHeadPoint.Y)
                
                local distance = (ssHeadPoint - zz).Magnitude
                local snapThreshold = FOVring.Radius / sensitivity
                
                if distance < snapThreshold then
                    cam.CFrame = CFrame.new(cam.CFrame.Position, curTar.Character.Head.Position)
                end
            else
                updateRGBColor()
            end
        end)
    else
        if lastRenderStep then
            lastRenderStep:Disconnect()
        end
        if FOVring then FOVring.Visible = false end
        if reticle then reticle.Visible = false end
    end
end

local Toggle = Tab:CreateToggle({
    Name = "Toggle Aimbot",
    Default = false,
    Callback = function(Value)
        if Value then
            ToggleAimBot()
        else
            ToggleAimBot()
        end
    end
})
-- Enhanced Aimbot Configuration
local AimbotConfig = {
    FOVRadius = 360,               -- Field of view radius
    LockStrength = 0.05,           -- Further reduced for subtle aim assistance
    BreakStrength = 8.0,           -- Lowered for a natural break feel
    MouseThreshold = 0.05,         -- Fine-tuned for responsive yet subtle adjustments
    SmoothTracking = true,         -- Keep gradual tracking enabled
    TrackingSpeed = 3.0            -- Slower for smoother aiming transitions
}

local function smoothLock(camera, targetPos)
    local currentAim = camera.CFrame.LookVector
    local targetAim = (targetPos - camera.CFrame.Position).Unit
    return CFrame.new(camera.CFrame.Position, camera.CFrame.Position + currentAim:Lerp(targetAim, AimbotConfig.LockStrength))
end

local function updateAimbot()
    if not aimbotEnabled then return end
    
    local camera = workspace.CurrentCamera
    local mouseMovement = UserInputService:GetMouseDelta().Magnitude
    
    -- Easy break on mouse movement
    if mouseMovement > AimbotConfig.MouseThreshold then
        aimbotEnabled = false
        if FOVring then FOVring.Visible = false end
        if reticle then reticle.Visible = false end
        RunService:UnbindFromRenderStep("Aimbot")
        return
    end
    
    local target = getClosestTarget(camera)
    if target.Player then
        local targetPart = target.Player.Character[AimbotConfig.TargetPart]
        local targetPos = targetPart.Position
        
        if AimbotConfig.SmoothTracking then
            camera.CFrame = smoothLock(camera, targetPos)
        end
    end
    
    if FOVring then
        FOVring.Position = camera.ViewportSize / 2
        FOVring.Color = target.Player and Color3.fromRGB(0, 255, 0) or Color3.fromRGB(255, 0, 0)
    end
end

local Button = Tab:CreateButton({
   Name = "Threat Detect",
   CurrentValue = false,
   Flag = "Toggle1", -- A flag is the identifier for the configuration file, make sure every element has a different flag if you're using configuration saving to ensure no overlaps
   Callback = function(Value)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera

-- Create indicators
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "ThreatIndicator"
ScreenGui.ResetOnSpawn = false
ScreenGui.Parent = LocalPlayer:WaitForChild("PlayerGui")

local indicators = {}
local sides = {
    Left = {size = UDim2.new(0.02, 0, 1, 0), pos = UDim2.new(0, 0, 0, 0)},
    Right = {size = UDim2.new(0.02, 0, 1, 0), pos = UDim2.new(0.98, 0, 0, 0)},
    Bottom = {size = UDim2.new(1, 0, 0.02, 0), pos = UDim2.new(0, 0, 0, 0)},
    Bottom = {size = UDim2.new(1, 0, 0.02, 0), pos = UDim2.new(0, 0, 0.98, 0)}
}

for side, props in pairs(sides) do
    local indicator = Instance.new("Frame")
    indicator.Name = side
    indicator.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
    indicator.BackgroundTransparency = 1
    indicator.Size = props.size
    indicator.Position = props.pos
    indicator.BorderSizePixel = 0
    indicator.Parent = ScreenGui
    indicators[side] = indicator
end

local function isPlayerThreat(otherPlayer)
    local myChar = LocalPlayer.Character
    local theirChar = otherPlayer.Character
    
    if not myChar or not theirChar then return false end
    
    local myHead = myChar:FindFirstChild("Head")
    local theirHead = theirChar:FindFirstChild("Head")
    
    if not myHead or not theirHead then return false end
    
    local toTarget = (myHead.Position - theirHead.Position).Unit
    local looking = theirHead.CFrame.LookVector
    local dot = toTarget:Dot(looking)
    
    return dot > 0.95
end

local function getRelativeDirection(targetPos)
    local myChar = LocalPlayer.Character
    if not myChar then return nil end
    
    local myHead = myChar:FindFirstChild("Head")
    if not myHead then return nil end
    
    local relativePos = targetPos - myHead.Position
    local myLook = Camera.CFrame.LookVector
    local right = Camera.CFrame.RightVector
    local up = Camera.CFrame.UpVector
    
    local rightDot = right:Dot(relativePos.Unit)
    local upDot = up:Dot(relativePos.Unit)
    local frontDot = myLook:Dot(relativePos.Unit)
    
    local absRightDot = math.abs(rightDot)
    local absUpDot = math.abs(upDot)
    
    if frontDot < 0 then -- Target is behind
        if absRightDot > absUpDot then
            return rightDot > 0 and "Right" or "Left"
        else
            return upDot > 0 and "Bottom" or "Bottom"
        end
    end
    return nil
end

RunService.RenderStepped:Connect(function()
    for _, indicator in pairs(indicators) do
        indicator.BackgroundTransparency = 1
    end
    
    for _, player in pairs(Players:GetPlayers()) do
        if player ~= LocalPlayer and player.Character then
            local head = player.Character:FindFirstChild("Head")
            if head and isPlayerThreat(player) then
                local direction = getRelativeDirection(head.Position)
                if direction and indicators[direction] then
                    indicators[direction].BackgroundTransparency = 0.3
                end
            end
        end
    end
end)

local function getRelativeDirection(targetPos)
    local myChar = LocalPlayer.Character
    if not myChar then return nil end
    
    local myHead = myChar:FindFirstChild("Head")
    if not myHead then return nil end
    
    local relativePos = targetPos - myHead.Position
    local myLook = Camera.CFrame.LookVector
    local right = Camera.CFrame.RightVector
    local up = Camera.CFrame.UpVector
    
    local rightDot = right:Dot(relativePos.Unit)
    local upDot = up:Dot(relativePos.Unit)
    local frontDot = myLook:Dot(relativePos.Unit)
    
    -- Enhanced front detection
    if frontDot > 0.5 then
        return "Bottom" -- They're in front of you
    elseif frontDot < -0.5 then
        return "Bottom" -- They're behind you
    elseif math.abs(rightDot) > math.abs(upDot) then
        return rightDot > 0 and "Right" or "Left"
    end
    
    return nil
end

-- Update the sides configuration for better visibility
local sides = {
    Left = {size = UDim2.new(0.02, 0, 1, 0), pos = UDim2.new(0, 0, 0, 0)},
    Right = {size = UDim2.new(0.02, 0, 1, 0), pos = UDim2.new(0.98, 0, 0, 0)},
    Bottom = {size = UDim2.new(1, 0, 0.03, 0), pos = UDim2.new(0, 0, 0, 0)}, -- Made Bottom indicator thicker
    Bottom = {size = UDim2.new(1, 0, 0.03, 0), pos = UDim2.new(0, 0, 0.97, 0)} -- Adjusted bottom position
}
-- Add these color configurations at the Bottom
local ColorConfig = {
    Far = Color3.fromRGB(0, 157, 255),  -- Bright Blue
    Mid = Color3.fromRGB(255, 157, 0),  -- Orange
    Close = Color3.fromRGB(255, 0, 0)   -- Dark Red
}

local DistanceThresholds = {
    Close = 10,   -- Units for close distance
    Mid = 50,     -- Units for medium distance
    Far = 150     -- Units for far distance
}

-- Function to get color based on distance
local function getColorFromDistance(distance)
    if distance <= DistanceThresholds.Close then
        return ColorConfig.Close
    elseif distance <= DistanceThresholds.Mid then
        local t = (distance - DistanceThresholds.Close) / (DistanceThresholds.Mid - DistanceThresholds.Close)
        return ColorConfig.Close:Lerp(ColorConfig.Mid, t)
    else
        local t = math.min((distance - DistanceThresholds.Mid) / (DistanceThresholds.Far - DistanceThresholds.Mid), 1)
        return ColorConfig.Mid:Lerp(ColorConfig.Far, t)
    end
end

-- Update the RunService connection with color calculation
RunService.RenderStepped:Connect(function()
    for _, indicator in pairs(indicators) do
        indicator.BackgroundTransparency = 1
    end
    
    for _, player in pairs(Players:GetPlayers()) do
        if player ~= LocalPlayer and player.Character then
            local head = player.Character:FindFirstChild("Head")
            if head and isPlayerThreat(player) then
                local direction = getRelativeDirection(head.Position)
                if direction and indicators[direction] then
                    -- Calculate distance and set color
                    local distance = (LocalPlayer.Character.Head.Position - head.Position).Magnitude
                    local threatColor = getColorFromDistance(distance)
                    
                    indicators[direction].BackgroundColor3 = threatColor
                    indicators[direction].BackgroundTransparency = 0.3
                end
            end
        end
    end
end)

-- Add this after your ScreenGui creation
local CounterGui = Instance.new("TextLabel")
CounterGui.Name = "ThreatCounter"
CounterGui.Size = UDim2.new(0, 200, 0, 50)
CounterGui.Position = UDim2.new(0.5, -100, 0, 10)
CounterGui.BackgroundTransparency = 1
CounterGui.TextColor3 = Color3.fromRGB(255, 0, 0)
CounterGui.TextSize = 24
CounterGui.Font = Enum.Font.GothamBold
CounterGui.Parent = ScreenGui

-- Update the RunService connection to include counter
RunService.RenderStepped:Connect(function()
    for _, indicator in pairs(indicators) do
        indicator.BackgroundTransparency = 1
    end
    
    local threatCount = 0
    local directions = {}
    
    for _, player in pairs(Players:GetPlayers()) do
        if player ~= LocalPlayer and player.Character then
            local head = player.Character:FindFirstChild("Head")
            if head and isPlayerThreat(player) then
                local direction = getRelativeDirection(head.Position)
                if direction then
                    threatCount = threatCount + 1
                    table.insert(directions, direction)
                    
                    local distance = (LocalPlayer.Character.Head.Position - head.Position).Magnitude
                    local threatColor = getColorFromDistance(distance)
                    
                    indicators[direction].BackgroundColor3 = threatColor
                    indicators[direction].BackgroundTransparency = 0.3
                end
            end
        end
    end
    
    -- Update counter text with directions
    if threatCount > 0 then
        CounterGui.Text = threatCount .. " Threats: " .. table.concat(directions, ", ")
    else
        CounterGui.Text = "No Threats"
    end
end)

   end,
})


-- Server Info Tab
local ServerInfoTab = Window:CreateTab("Server Info", nil)

-- Time In Server
local startTime = tick()
local serverUptimeLabel = ServerInfoTab:CreateLabel("Time In Server: 0 seconds")

-- Update Time In Server every second
local function updateServerUptime()
   while true do
       local uptime = tick() - startTime
       serverUptimeLabel:Set("Time In Server: " .. math.floor(uptime) .. " seconds")
       wait(1)
   end
end
task.spawn(updateServerUptime)

-- Player Count
local playerCount = #game.Players:GetPlayers()
local maxPlayerCount = game.Players.MaxPlayers
local playerLabel = ServerInfoTab:CreateLabel("Players: " .. playerCount .. "/" .. maxPlayerCount)

-- Server FPS
local serverFPS = nil
local fpsLabel = ServerInfoTab:CreateLabel("My Server FPS: Calculating...")

-- Update server FPS every second
local function updateServerFPS()
   local startTime = os.clock()
   local frameCount = 0
   
   while true do
       game:GetService("RunService").RenderStepped:Wait()
       frameCount = frameCount + 1
       
       if os.clock() - startTime >= 1 then
           serverFPS = frameCount
           fpsLabel:Set("My Server FPS: " .. tostring(serverFPS))
           startTime = os.clock()
           frameCount = 0
       end
   end
end
task.spawn(updateServerFPS)

-- Server Hop and Rejoin
local rejoinButton = ServerInfoTab:CreateButton({
   Name = "Rejoin Server",
   Callback = function()
       local ts = game:GetService("TeleportService")
       local p = game:GetService("Players").LocalPlayer
       ts:Teleport(game.PlaceId, p)
   end
})

local serverHopButton = ServerInfoTab:CreateButton({
   Name = "Server Hop",
   Callback = function()
       local ts = game:GetService("TeleportService")
       local p = game:GetService("Players").LocalPlayer
       ts:TeleportToPlaceInstance(game.PlaceId, game.JobId, p)
   end
})

local Button = ServerInfoTab:CreateButton({
    Name = "Server Browser",
    Callback = function()
        -- Services
        local TeleportService = game:GetService("TeleportService")
        local Players = game:GetService("Players")
        local HttpService = game:GetService("HttpService")
        local RunService = game:GetService("RunService")

        -- Create ScreenGui
        local screenGui = Instance.new("ScreenGui")
        screenGui.Name = "ServerBrowserGui"
        screenGui.Parent = Players.LocalPlayer:WaitForChild("PlayerGui")

        -- Create the server browser frame
        local browserFrame = Instance.new("Frame")
        browserFrame.Name = "BrowserFrame"
        browserFrame.Size = UDim2.new(0.7, 0, 0.8, 0)
        browserFrame.Position = UDim2.new(0.15, 0, 0.1, 0)
        browserFrame.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
        browserFrame.BorderSizePixel = 0
        browserFrame.Parent = screenGui

        -- Add rounded corners
        local corner = Instance.new("UICorner")
        corner.CornerRadius = UDim.new(0, 8)
        corner.Parent = browserFrame

        -- Add title
        local titleLabel = Instance.new("TextLabel")
        titleLabel.Size = UDim2.new(1, 0, 0.08, 0)
        titleLabel.Position = UDim2.new(0, 0, 0, 0)
        titleLabel.Text = "Server Browser"
        titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
        titleLabel.TextSize = 24
        titleLabel.Font = Enum.Font.GothamBold
        titleLabel.BackgroundTransparency = 1
        titleLabel.Parent = browserFrame

        -- Current Server Info
        local currentServerInfo = Instance.new("Frame")
        currentServerInfo.Size = UDim2.new(0.95, 0, 0.15, 0)
        currentServerInfo.Position = UDim2.new(0.025, 0, 0.1, 0)
        currentServerInfo.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
        currentServerInfo.BorderSizePixel = 0
        currentServerInfo.Parent = browserFrame

        local currentServerCorner = Instance.new("UICorner")
        currentServerCorner.CornerRadius = UDim.new(0, 6)
        currentServerCorner.Parent = currentServerInfo

        local currentServerTitle = Instance.new("TextLabel")
        currentServerTitle.Size = UDim2.new(1, 0, 0.4, 0)
        currentServerTitle.Position = UDim2.new(0, 0, 0, 0)
        currentServerTitle.Text = "Current Server"
        currentServerTitle.TextColor3 = Color3.fromRGB(255, 255, 255)
        currentServerTitle.TextSize = 18
        currentServerTitle.Font = Enum.Font.GothamBold
        currentServerTitle.BackgroundTransparency = 1
        currentServerTitle.Parent = currentServerInfo

        local currentServerStats = Instance.new("TextLabel")
        currentServerStats.Size = UDim2.new(1, 0, 0.6, 0)
        currentServerStats.Position = UDim2.new(0, 0, 0.4, 0)
        currentServerStats.TextColor3 = Color3.fromRGB(200, 200, 200)
        currentServerStats.TextSize = 16
        currentServerStats.Font = Enum.Font.Gotham
        currentServerStats.BackgroundTransparency = 1
        currentServerStats.Parent = currentServerInfo

        -- Create scroll frame
        local scrollFrame = Instance.new("ScrollingFrame")
        scrollFrame.Size = UDim2.new(0.95, 0, 0.65, 0)
        scrollFrame.Position = UDim2.new(0.025, 0, 0.28, 0)
        scrollFrame.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
        scrollFrame.BorderSizePixel = 0
        scrollFrame.ScrollBarThickness = 6
        scrollFrame.ScrollBarImageColor3 = Color3.fromRGB(200, 200, 200)
        scrollFrame.Parent = browserFrame

        local scrollCorner = Instance.new("UICorner")
        scrollCorner.CornerRadius = UDim.new(0, 6)
        scrollCorner.Parent = scrollFrame

        -- Create refresh button
        local refreshButton = Instance.new("TextButton")
        refreshButton.Size = UDim2.new(0.15, 0, 0.06, 0)
        refreshButton.Position = UDim2.new(0.025, 0, 0.93, 0)
        refreshButton.Text = "Refresh"
        refreshButton.TextSize = 16
        refreshButton.Font = Enum.Font.GothamBold
        refreshButton.BackgroundColor3 = Color3.fromRGB(65, 65, 65)
        refreshButton.TextColor3 = Color3.fromRGB(255, 255, 255)
        refreshButton.Parent = browserFrame

        local refreshCorner = Instance.new("UICorner")
        refreshCorner.CornerRadius = UDim.new(0, 6)
        refreshCorner.Parent = refreshButton

        -- Create close button
        local closeButton = Instance.new("TextButton")
        closeButton.Size = UDim2.new(0, 30, 0, 30)
        closeButton.Position = UDim2.new(0.96, 0, 0.02, 0)
        closeButton.Text = "×"
        closeButton.TextSize = 24
        closeButton.Font = Enum.Font.GothamBold
        closeButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
        closeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
        closeButton.Parent = browserFrame

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

        -- Update current server info
        local function updateCurrentServerInfo()
            local currentPlayers = #Players:GetPlayers()
            local maxPlayers = Players.MaxPlayers
            local ping = math.floor(Players.LocalPlayer:GetNetworkPing() * 1000)
            currentServerStats.Text = string.format("Players: %d/%d | Ping: %dms | Server ID: %s", 
                currentPlayers, 
                maxPlayers, 
                ping,
                game.JobId)
        end

        -- Get server list
        local function fetchServers()
            local placeId = game.PlaceId
            local servers = {}
            
            -- Clear existing server buttons
            for _, child in ipairs(scrollFrame:GetChildren()) do
                if child:IsA("TextButton") then
                    child:Destroy()
                end
            end
            
            local success, result = pcall(function()
                return HttpService:JSONDecode(game:HttpGet("https://[Log in to view URL]" .. placeId .. "/servers/Public?sortOrder=Desc&limit=100"))
            end)
            
            if success and result and result.data then
                local yOffset = 0
                for _, server in ipairs(result.data) do
                    -- Server container
                    local serverContainer = Instance.new("Frame")
                    serverContainer.Size = UDim2.new(0.95, 0, 0, 70)
                    serverContainer.Position = UDim2.new(0.025, 0, 0, yOffset)
                    serverContainer.BackgroundColor3 = Color3.fromRGB(55, 55, 55)
                    serverContainer.BorderSizePixel = 0
                    serverContainer.Parent = scrollFrame

                    local containerCorner = Instance.new("UICorner")
                    containerCorner.CornerRadius = UDim.new(0, 6)
                    containerCorner.Parent = serverContainer

                    -- Server info
                    local serverInfo = Instance.new("TextLabel")
                    serverInfo.Size = UDim2.new(0.7, 0, 1, 0)
                    serverInfo.Position = UDim2.new(0.02, 0, 0, 0)
                    serverInfo.Text = string.format("Players: %d/%d\nPing: %dms\nServer ID: %s", 
                        server.playing, 
                        server.maxPlayers, 
                        server.ping,
                        server.id:sub(1, 8) .. "...")
                    serverInfo.TextColor3 = Color3.fromRGB(255, 255, 255)
                    serverInfo.TextSize = 14
                    serverInfo.Font = Enum.Font.Gotham
                    serverInfo.TextXAlignment = Enum.TextXAlignment.Left
                    serverInfo.BackgroundTransparency = 1
                    serverInfo.Parent = serverContainer

                    -- Join button
                    local joinButton = Instance.new("TextButton")
                    joinButton.Size = UDim2.new(0.25, 0, 0.6, 0)
                    joinButton.Position = UDim2.new(0.73, 0, 0.2, 0)
                    joinButton.Text = "Join Server"
                    joinButton.TextSize = 14
                    joinButton.Font = Enum.Font.GothamBold
                    joinButton.BackgroundColor3 = Color3.fromRGB(65, 165, 65)
                    joinButton.TextColor3 = Color3.fromRGB(255, 255, 255)
                    joinButton.Parent = serverContainer

                    local joinCorner = Instance.new("UICorner")
                    joinCorner.CornerRadius = UDim.new(0, 4)
                    joinCorner.Parent = joinButton

                    joinButton.MouseButton1Click:Connect(function()
                        TeleportService:TeleportToPlaceInstance(placeId, server.id)
                    end)
                    
                    yOffset = yOffset + 80
                end
                scrollFrame.CanvasSize = UDim2.new(0, 0, 0, yOffset)
            end
        end

        -- Button handlers
        closeButton.MouseButton1Click:Connect(function()
            screenGui:Destroy()
        end)

        refreshButton.MouseButton1Click:Connect(fetchServers)

        -- Update current server info periodically
        local updateConnection = RunService.Heartbeat:Connect(function()
            updateCurrentServerInfo()
        end)

        -- Clean up when GUI is destroyed
        screenGui.Destroying:Connect(function()
            if updateConnection then
                updateConnection:Disconnect()
            end
        end)

        -- Initial fetch
        updateCurrentServerInfo()
        fetchServers()
    end
})

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


-- Create the time label
local TimeLabel = MainTab:CreateLabel("Time: 00:00:00 AM")

-- Auto-update time every second
coroutine.wrap(function()
    while task.wait(1) do
        local hour = os.date("%I")  -- 12-hour format
        local min = os.date("%M")
        local sec = os.date("%S")
        local ampm = os.date("%p")  -- AM/PM indicator
        local current_time = string.format("%s:%s:%s %s", hour, min, sec, ampm)
        TimeLabel:Set("Time: " .. current_time)
    end
end)()

local Tab = Window:CreateTab("Games", nil) -- Title, Image

local Section = Tab:CreateSection("Combat Warriors")

local Button = Tab:CreateButton({
   Name = "Enable Hitbox Expander",
   Callback = function()
        _G.Disabled = true -- Turns on the hitbox expander
   end,
})

-- Create the size slider
local HeadSlider = Tab:CreateSlider({
    Name = "Head Size",
    Range = {1, 10},
    Increment = 0.1,
    Suffix = "x",
    CurrentValue = 5,
    Flag = "HeadSizeValue",
    Callback = function(Value)
        _G.HeadSize = Value
    end,
})

-- Initialize the global variables
_G.HeadSize = 10
_G.Disabled = false

-- Main loop
game:GetService('RunService').RenderStepped:connect(function()
    if _G.Disabled then
        for i,v in next, game:GetService('Players'):GetPlayers() do
            if v.Name ~= game:GetService('Players').LocalPlayer.Name then
                pcall(function()
                    v.Character.Head.Size = Vector3.new(_G.HeadSize,_G.HeadSize,_G.HeadSize)
                    v.Character.Head.Transparency = 0  -- Changed from 1 to 0 to make heads visible
                    v.Character.Head.BrickColor = BrickColor.new("Red")
                    v.Character.Head.Material = "Neon"
                    v.Character.Head.CanCollide = false
                    v.Character.Head.Massless = true
                end)
            end
        end
    end
end)






local Tab = Window:CreateTab("LoadStrings", nil) -- Title, Image

local Button = Tab:CreateButton({
   Name = "Therapy Game GUI",
   Callback = function()
loadstring(game:HttpGet("https://[Log in to view URL]",true))()
   end,
})

local Button = Tab:CreateButton({
   Name = "ChatByPasser",
   Callback = function()
loadstring(game:HttpGet("https://[Log in to view URL]",true))()
   end,
})

-- Add these variables at the top of your script, after the Window creation
local LastDeathPosition = nil
local TeleportToDeathEnabled = false
local HasAntiTeleport = nil -- Will store if server has Server Anti-Teleport

-- Function to test for Server Anti-Teleport
local function CheckForAntiTeleport()
    local character = game.Players.LocalPlayer.Character
    if not character then return end
    
    local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
    local originalPosition = humanoidRootPart.Position
    local testDistance = 100 -- Distance to test teleport
    
    -- Try a small teleport
    local success = pcall(function()
        humanoidRootPart.CFrame = CFrame.new(originalPosition + Vector3.new(testDistance, 0, 0))
    end)
    
    -- Wait a tiny bit and check position
    task.wait(0.1)
    local newPosition = humanoidRootPart.Position
    local teleported = (newPosition - originalPosition).Magnitude > testDistance/2
    
    -- Return to original position
    humanoidRootPart.CFrame = CFrame.new(originalPosition)
    
    -- Check if we were able to teleport
    if not success or not teleported then
        HasAntiTeleport = true
        Rayfield:Notify({
            Title = "Server Anti-Teleport Detected",
            Content = "This server has Server Anti-Teleport measures enabled!",
            Duration = 6.5,
            Image = nil,
        })
    else
        HasAntiTeleport = false
        Rayfield:Notify({
            Title = "Teleport Check",
            Content = "No Server Anti-Teleport detected. Teleporting is allowed!",
            Duration = 6.5,
            Image = nil,
        })
    end
end

-- Add to your existing Main section
local TPLabel = MainTab:CreateLabel("Server Anti-Teleport Status: Not Checked")

-- Button to check for Server Anti-Teleport
local CheckTPButton = MainTab:CreateButton({
    Name = "Check Server Anti-Teleport",
    Callback = function()
        TPLabel:Set("Server Server Anti-Teleport Status: Checking...")
        CheckForAntiTeleport()
        task.wait(0.5)
        TPLabel:Set("SServer Anti-Teleport Status: " .. (HasAntiTeleport and "Enabled ❌" or "Disabled ✅"))
    end
})

-- Toggle for Auto Teleport to Death
local AutoDeathToggle = MainTab:CreateToggle({
    Name = "Auto Teleport to Death",
    CurrentValue = false,
    Flag = "AutoDeathTP",
    Callback = function(Value)
        TeleportToDeathEnabled = Value
        
        if Value then
            if HasAntiTeleport then
                Rayfield:Notify({
                    Title = "Warning",
                    Content = "Server Anti-Teleport is enabled on this server. Teleporting might not work!",
                    Duration = 6.5,
                    Image = nil,
                })
            end
            
            -- Connect death detection
            local function onCharacterDied()
                local character = game.Players.LocalPlayer.Character
                if character then
                    LastDeathPosition = character:WaitForChild("HumanoidRootPart").Position
                    
                    -- Wait for respawn
                    character:WaitForChild("Humanoid").Died:Connect(function()
                        if TeleportToDeathEnabled then
                            task.wait(game.Players.RespawnTime + 0.5) -- Wait for respawn
                            local newCharacter = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
                            local humanoidRootPart = newCharacter:WaitForChild("HumanoidRootPart")
                            
                            -- Teleport to death position
                            if not HasAntiTeleport then
                                humanoidRootPart.CFrame = CFrame.new(LastDeathPosition)
                            end
                        end
                    end)
                end
            end
            
            -- Connect to current and future characters
            if game.Players.LocalPlayer.Character then
                onCharacterDied()
            end
            game.Players.LocalPlayer.CharacterAdded:Connect(onCharacterDied)
        end
    end
})

-- Button to Teleport to Last Death Position
local LastDeathButton = MainTab:CreateButton({
    Name = "Teleport to Last Death",
    Callback = function()
        if HasAntiTeleport then
            Rayfield:Notify({
                Title = "Warning",
                Content = "Server Anti-Teleport is enabled. Teleport might not work!",
                Duration = 3,
            })
        end
        
        if LastDeathPosition then
            local character = game.Players.LocalPlayer.Character
            if character and character:FindFirstChild("HumanoidRootPart") then
                character.HumanoidRootPart.CFrame = CFrame.new(LastDeathPosition)
            end
        else
            Rayfield:Notify({
                Title = "No Death Position",
                Content = "You haven't died yet!",
                Duration = 3,
            })
        end
    end
})

-- Create a universal teleport handler
local function SafeTeleport(position)
    if not HasAntiTeleport then
        local character = game.Players.LocalPlayer.Character
        if character and character:FindFirstChild("HumanoidRootPart") then
            local originalPos = character.HumanoidRootPart.Position
            
            -- Try teleporting
            character.HumanoidRootPart.CFrame = CFrame.new(position)
            
            -- Check if teleport was successful
            task.wait(0.1)
            local newPos = character.HumanoidRootPart.Position
            if (newPos - originalPos).Magnitude < 5 then
                -- Teleport failed, update Server Anti-Teleport status
                HasAntiTeleport = true
                TPLabel:Set("Server Anti-Teleport Status: Enabled ❌")
                Rayfield:Notify({
                    Title = "Server Anti-Teleport Detected",
                    Content = "Teleport failed! Server has Server Anti-Teleport.",
                    Duration = 3,
                })
            end
        end
    else
        Rayfield:Notify({
            Title = "Warning",
            Content = "Server Anti-Teleport is enabled on this server!",
            Duration = 3,
        })
    end
end

-- Track death position for all characters
game.Players.LocalPlayer.CharacterAdded:Connect(function(character)
    character:WaitForChild("Humanoid").Died:Connect(function()
        LastDeathPosition = character:WaitForChild("HumanoidRootPart").Position
    end)
end)

-- Run initial Server Anti-Teleport check when the script loads
task.spawn(function()
    task.wait(1) -- Wait for character to load
    CheckForAntiTeleport()
    TPLabel:Set("Server Anti-Teleport Status: " .. (HasAntiTeleport and "Enabled ❌" or "Disabled ✅"))
end)

-- Add this code right after your Window creation and before any tabs

local function ShowLoadingSuccess()
    Rayfield:Notify({
        Title = "Script Loaded Successfully ✅",
        Content = "All features are ready to use!",
        Duration = 6.5,
        Image = nil,
        Actions = {
            Acknowledge = {
                Name = "Okay!",
                Callback = function()
                    print("User acknowledged successful load")
                end
            },
        },
    })
end

local function ShowLoadingError(errorMessage)
    Rayfield:Notify({
        Title = "Loading Error ❌",
        Content = "Error: " .. errorMessage,
        Duration = 10,
        Image = nil,
        Actions = {
            Acknowledge = {
                Name = "Got it",
                Callback = function()
                    print("User acknowledged error: " .. errorMessage)
                end
            },
        },
    })
end

local Tab = Window:CreateTab("Fully shut down GUI", nil) -- Title, Image


local CloseButton = Tab:CreateButton({
    Name = "Close GUI",
    Callback = function()
        Rayfield:Destroy() -- This will completely remove the GUI
    end
})

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

-- Remove existing StatsGui if it exists
local function removeExistingGui()
    local parent = RunService:IsStudio() and Players.LocalPlayer:WaitForChild("PlayerGui") or game:GetService("CoreGui")
    local existingGui = parent:FindFirstChild("StatsGui")
    if existingGui then
        existingGui:Destroy()
    end
end

-- Remove any existing GUI before creating a new one
removeExistingGui()

-- Create the UI elements
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "StatsGui"
ScreenGui.ResetOnSpawn = false
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling

local Frame = Instance.new("Frame")
Frame.Name = "StatsFrame"
Frame.Size = UDim2.new(0, 160, 0, 95)
Frame.Position = UDim2.new(1, -170, 0, 10)
Frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
Frame.BackgroundTransparency = 0.5
Frame.BorderSizePixel = 0
Frame.Parent = ScreenGui

-- Add a drag handle with text
local DragHandle = Instance.new("TextButton")
DragHandle.Name = "DragHandle"
DragHandle.Size = UDim2.new(1, 0, 0, 20)
DragHandle.Position = UDim2.new(0, 0, 0, 0)
DragHandle.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
DragHandle.BackgroundTransparency = 0.3
DragHandle.BorderSizePixel = 0
DragHandle.Text = "≡ Performance Stats ≡"
DragHandle.TextColor3 = Color3.fromRGB(255, 255, 255)
DragHandle.TextSize = 14
DragHandle.Font = Enum.Font.GothamBold
DragHandle.AutoButtonColor = false
DragHandle.Parent = Frame
DragHandle.ZIndex = 1

-- Function to create labels
local function createLabel(name, position)
    local label = Instance.new("TextLabel")
    label.Name = name
    label.Size = UDim2.new(1, 0, 0, 24)
    label.Position = UDim2.new(0, 0, 0, position)
    label.BackgroundTransparency = 1
    label.TextColor3 = Color3.fromRGB(255, 255, 255)
    label.TextSize = 14
    label.Font = Enum.Font.GothamBold
    label.TextXAlignment = Enum.TextXAlignment.Left
    label.Parent = Frame
    return label
end

-- Create only the needed labels
local FPSLabel = createLabel("FPSLabel", 25)
local PingLabel = createLabel("PingLabel", 45)
local PlayersLabel = createLabel("PlayersLabel", 65)

-- Performance thresholds
local FPS_THRESHOLD = 30  -- FPS below this will be red
local PING_THRESHOLD = 200  -- Ping above this will be red

-- Color constants
local COLOR_GOOD = Color3.fromRGB(0, 255, 0)   -- Green
local COLOR_BAD = Color3.fromRGB(255, 0, 0)    -- Red

-- Improved dragging functionality
local dragging = false
local dragInput
local dragStart
local startPos

local function update(input)
    if not dragging then return end
    local delta = input.Position - dragStart
    local newPosition = UDim2.new(
        startPos.X.Scale,
        startPos.X.Offset + delta.X,
        startPos.Y.Scale,
        startPos.Y.Offset + delta.Y
    )
    Frame.Position = newPosition
end

DragHandle.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
        dragging = true
        dragStart = input.Position
        startPos = Frame.Position
        input.Changed:Connect(function()
            if input.UserInputState == Enum.UserInputState.End then
                dragging = false
            end
        end)
    end
end)

DragHandle.InputChanged:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
        dragInput = input
    end
end)

UserInputService.InputChanged:Connect(function(input)
    if input == dragInput and dragging then
        update(input)
    end
end)

-- FPS Counter variables
local fps = 0
local frames = 0
local lastTime = tick()

-- Update FPS
RunService.RenderStepped:Connect(function()
    frames = frames + 1
    local currentTime = tick()
    local deltaTime = currentTime - lastTime
    
    if deltaTime >= 1 then
        fps = math.floor(frames / deltaTime)
        frames = 0
        lastTime = currentTime
        FPSLabel.Text = "  FPS: " .. tostring(fps)
        -- Change color based on FPS threshold
        FPSLabel.TextColor3 = fps < FPS_THRESHOLD and COLOR_BAD or COLOR_GOOD
    end
end)

-- Update Ping
RunService.Heartbeat:Connect(function()
    local ping = math.floor(Players.LocalPlayer:GetNetworkPing() * 1000)
    PingLabel.Text = string.format("  Ping: %dms", ping)
    -- Change color based on ping threshold
    PingLabel.TextColor3 = ping > PING_THRESHOLD and COLOR_BAD or COLOR_GOOD
end)

-- Update Players Count
local function updatePlayerCount()
    local playerCount = #Players:GetPlayers()
    local maxPlayers = Players.MaxPlayers
    PlayersLabel.Text = string.format("  Players: %d/%d", playerCount, maxPlayers)
    PlayersLabel.TextColor3 = Color3.fromRGB(255, 255, 255)  -- Always white
end

Players.PlayerAdded:Connect(updatePlayerCount)
Players.PlayerRemoving:Connect(updatePlayerCount)
updatePlayerCount()

-- Parent the ScreenGui to the appropriate location
if RunService:IsStudio() then
    ScreenGui.Parent = Players.LocalPlayer:WaitForChild("PlayerGui")
else
    ScreenGui.Parent = game:GetService("CoreGui")
end

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: