local Compkiller = loadstring(game:HttpGet("https://[Log in to view URL]"))();

local Notifier = Compkiller.newNotify();

local ConfigManager = Compkiller:ConfigManager({
	Directory = "Compkiller-UI",
	Config = "Example-Configs"
});

Compkiller:Loader("rbxassetid://81817688420352", 1.5).yield();

-- Mobile Detection
local UserInputService = game:GetService("UserInputService")
local GuiService = game:GetService("GuiService")

local function isMobile()
	-- Check if touch is enabled (mobile/tablet)
	if UserInputService.TouchEnabled and not UserInputService.KeyboardEnabled then
		return true
	end
	-- Additional check for mobile devices
	if UserInputService.TouchEnabled and not UserInputService.MouseEnabled then
		return true
	end
	return false
end

-- Determine scale based on device
local windowScale
if isMobile() then
	windowScale = 0.83 -- Smaller scale for mobile devices
else
	windowScale = Compkiller.Scale.Window -- Default scale for PC
end

local MenuKey = "LeftAlt"
local Window = Compkiller.new({
	Name = "Scorpio Hub",
	Keybind = MenuKey,
	Logo = "rbxassetid://81817688420352",
	TextSize = isMobile() and 18 or 15, -- Slightly larger text on mobile for readability
});

local UserSettings = Window.UserSettings:Create();
UserSettings:AddColorPicker({
	Name = "Menu Color",
	Default = Color3.fromRGB(255, 0, 0),
	Callback = function(f)
		Compkiller.Colors.Highlight = f
		Compkiller:RefreshCurrentColor()
	end,
})
UserSettings:AddKeybind({
	Name = "Menu Key",
	Default = MenuKey,
	Callback = function(f)
		MenuKey = f;
		
		Window:SetMenuKey(MenuKey)
	end,
});
UserSettings:AddDropdown({
	Name = "Menu Theme",
	Values = {
		"Red & Black",
		"Default",
		"Dark Green",
		"Dark Blue",
		"Purple Rose",
		"Skeet"
	},

	Default = "Red & Black",

	Callback = function(f)
		if f == "Red & Black" then
			Compkiller.Colors.Highlight = Color3.fromRGB(255, 0, 0)
			Compkiller.Colors.Background = Color3.fromRGB(10, 10, 10)
			Compkiller.Colors.Secondary = Color3.fromRGB(20, 20, 20)
			Compkiller.Colors.Text = Color3.fromRGB(255, 255, 255)

			Compkiller:RefreshCurrentColor()
		else
			Compkiller:SetTheme(f)
		end
	end,
});
UserSettings:AddDropdown({
	Name = "Visible Widgets",
	Values = {"Watermark","Keybinds","Double Tab"},
	Multi = true,
	Default = {"Watermark"},
	Callback = function(f)
		print(f)
	end,
});
Window:DrawCategory({
	Name = "Scorpio Hub"
});

-- Creating Tab --
local NormalTab = Window:DrawTab({
	Name = "Main",
	Icon = "sun",
	EnableScrolling = true
});

-- Creating Section --
local NormalSection = NormalTab:DrawSection({
	Name = "Teleport",
	Position = 'left'	
});
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local humanoidRootPart

getgenv().SwimMethod = false


--// CHARACTER REFERENCES
local function updateCharacterReferences()
	local character = player.Character or player.CharacterAdded:Wait()
	humanoidRootPart = character:WaitForChild("HumanoidRootPart", 5)
end

if player.Character then
	updateCharacterReferences()
end

player.CharacterAdded:Connect(updateCharacterReferences)


--// LOCATIONS
local locations = {
	["💳 Bank"] = Vector3.new(-1215.96, 253.88, -3636.11),
	["🏚️ Money Wash"] = Vector3.new(-376.1771 - 601, 197.6838 + 56, -1975.5855 + 1035 + 248),
	["🪙 Safe Items"] = Vector3.new(48917.8984 + 19597, 53680.5 - 396 - 343, -796.09),
	["💎 Pawn Shop"] = Vector3.new(-23.6431 - 1026, 391.5367 - 138, -1118.2697 + 300 + 4),
	["🔒 Bank Vault"] = Vector3.new(-1152.12, 253.78, -3657.94),
	["💥 GunShop 1"] = Vector3.new(92959.8671875, 122098.5, 17244.462890625),
	["🏠 GunShop 1 Lobby"] = Vector3.new(-1002.4224, 563.6382 - 310, -1685.9125 + 244 + 638),
	["🎯 GunShop 2"] = Vector3.new(66195.4453125, 123615.7109375, 5750.28271484375),
	["🚪 GunShop 2 Lobby"] = Vector3.new(-224.3818359375, 283.8034362792969, -794.7174072265625),
	["🔫 GunShop 3"] = Vector3.new(61041.3086 - 55 - 166, 16979.1484 + 70630, -36.4746 - 315),
	["🏙️ Pent House"] = Vector3.new(-1531.23, 463.39, -3718.06),
	["🏡 Mini Mansion"] = Vector3.new(-791.5180053710938, 256.7944641113281, 1414.4248046875),
	["🧳 Backpack Shop"] = Vector3.new(),
	["💠⌚ Frozen Shop"] = Vector3.new(-216.31436157226562, 284.031494140625, -1169.032470703125),
	["💦 Drip Shop"] = Vector3.new(7378.6953 + 60084, 18630.0352 - 8141, 205.5895 + 344),
	["🥪🥓 Deli"] = Vector3.new(-755.8114013671875, 254.6927490234375, -687.1181640625),
	["🚙 Car Dealer"] = Vector3.new(-401.99371337890625, 253.4141082763672, -1248.8380126953125),
	["👔 Drip Store"] = Vector3.new(67462, 10489.21484375, 546.1941528320312),
	["🥤 Soda Warehouse"] = Vector3.new(-187.85504150390625, 284.6252136230469, -291.3419189453125),
	["🍾🥂 Soda Supplies"] = Vector3.new(-403.09906005859375, 254.20343017578125, -580.0437622070312),
	["🍹 Vendor"] = Vector3.new(-1292.2200927734375, 253.30044555664062, -3003.04833984375),
	["🐊 Exotic Dealer"] = Vector3.new(-1523.5654296875, 273.9729919433594, -990.6575317382812),
	["⚙️ Switch Seller"] = Vector3.new(-1446.2166748046875, 256.059814453125, 2189.876220703125),
	["🏦 Bank Tools"] = Vector3.new(-397.4308776855469, 334.3142395019531, -555.7023315429688),
	["🏗️ Construction Site"] = Vector3.new(-3120.8307 + 135 + 1254, 1393.8123 - 1023, -5490.8387 + 4314),
	["🚓 Prison"] = Vector3.new(-1135.0464, 254.7160, -3330.9954),
	["🍔 McDonalds"] = Vector3.new(-1012.13, 253.71, -1148.07),
	["🧊 Ice Box"] = Vector3.new(-120.1407 - 95, 283.5154, -1173.691 - 85),
	["🏥 Hospital"] = Vector3.new(-1589.504150390625, 254.27223205566406, 17.6555233001709),
	["🛒 MarGreens"] = Vector3.new(-381.20751953125, 254.45382690429688, -385.66546630859375),
	["🕵️‍♂️ Feds Room"] = Vector3.new(-1441.7904052734375, 255.03651428222656, -3132.597412109375),
	["💰 ATM 1"] = Vector3.new(-1011.9066162109375, 253.7509002685547, -1153.7340087890625),
	["🏧 ATM 3"] = Vector3.new(-96.72356414794922, 283.6329345703125, -766.3309326171875),
}

--// ORDERED KEYS FOR DROPDOWN
local orderedLocations = {
	"💥 GunShop 1","🏠 GunShop 1 Lobby","🎯 GunShop 2","🚪 GunShop 2 Lobby","🔫 GunShop 3",
	"💳 Bank","🔒 Bank Vault","🏦 Bank Tools","💰 ATM 1","💵 ATM 2","🏧 ATM 3","🏚️ Money Wash",
	"🏙️ Pent House","🍃☕ Pent House2","🏡 Mini Mansion",
	"🪙 Safe Items","💎 Pawn Shop","🧳 Backpack Shop","💠⌚ Frozen Shop","💦 Drip Shop",
	"🍗🔥 Chicken Wings","🥪🥓 Deli","🚙 Car Dealer","👔 Drip Store","🥤 Soda Warehouse",
	"🍾🥂 Soda Supplies","🍹 Vendor","🐊 Exotic Dealer","⚙️ Switch Seller",
	"🏗️ Construction Site","🚓 Prison","🍔 McDonalds","🧊 Ice Box","🏥 Hospital",
	"🛒 MarGreens","🕵️‍♂️ Feds Room"
}


--// NOTIFICATIONS
local function notify(title, content, duration)
	Notifier.new({
		Title = title,
		Content = content,
		Duration = duration or 2,
		Icon = "rbxassetid://81817688420352"
	})
end


--// TELEPORT (YOUR EXACT MOVEMENT METHOD)
local function teleportToLocation(locVec, locName)
	updateCharacterReferences()

	local humanoid = humanoidRootPart and humanoidRootPart.Parent:FindFirstChild("Humanoid")
	if not humanoid then return end

	getgenv().SwimMethod = true

	humanoid:ChangeState(0)
	repeat task.wait(0.0001) until not player:GetAttribute("LastACPos")

	humanoidRootPart.CFrame = CFrame.new(locVec)

	task.wait()
	humanoid:ChangeState(2)

	getgenv().SwimMethod = false

	notify("TP", "Teleported to " .. tostring(locName), 2)
end


--// DROPDOWN
NormalSection:AddDropdown({
	Name = "Select Location",
	Default = orderedLocations[1],
	Flag = "Location_Dropdown",
	Values = orderedLocations,
	Callback = function(selected)
		if not selected then return end

		notify("Location Selected", selected, 1.5)

		task.spawn(function()
			teleportToLocation(locations[selected], selected)
		end)
	end
})












-- Services
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Workspace = game:GetService("Workspace")
local StarterGui = game:GetService("StarterGui")

-- Variables
local LocalPlayer = Players.LocalPlayer
local Cooldown = false
local humanoidRootPart

-- Keep HumanoidRootPart updated
local function updateCharacterReferences()
    local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
    humanoidRootPart = character:WaitForChild("HumanoidRootPart", 10)
    return character, humanoidRootPart
end

LocalPlayer.CharacterAdded:Connect(function(char)
    humanoidRootPart = char:WaitForChild("HumanoidRootPart", 10)
end)

if LocalPlayer.Character then
    humanoidRootPart = LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
end

-- Teleport function with anti-detection
local function Teleport(cframe, bool)
    updateCharacterReferences()
    
    local humanoid = humanoidRootPart and humanoidRootPart.Parent:FindFirstChild("Humanoid")
    if not humanoid then return end
    
    getgenv().SwimMethod = true
    
    humanoid:ChangeState(0)
    repeat task.wait(0.0001) until not LocalPlayer:GetAttribute("LastACPos")
    
    humanoidRootPart.CFrame = cframe
    
    task.wait(0.1)
    humanoid:ChangeState(2)
    
    getgenv().SwimMethod = false
end

-- Get Fruit Cup function
local function GetFruitCup()
    local Found, Cup = false, nil
    
    for _, Value in ipairs(LocalPlayer.Backpack:GetChildren()) do
        if Value:IsA("Tool") and Value.Name == "Ice-Fruit Cupz" then
            if Value:FindFirstChild("IceFruit Cup") and 
               Value["IceFruit Cup"]:FindFirstChild("IceFruit PunchMedium") and
               Value["IceFruit Cup"]["IceFruit PunchMedium"].Transparency ~= 1 then
                Found = true
                Cup = Value
                break
            end
        end
    end
    
    if not Found and LocalPlayer.Character then
        for _, Value in ipairs(LocalPlayer.Character:GetChildren()) do
            if Value:IsA("Tool") and Value.Name == "Ice-Fruit Cupz" then
                if Value:FindFirstChild("IceFruit Cup") and 
                   Value["IceFruit Cup"]:FindFirstChild("IceFruit PunchMedium") and
                   Value["IceFruit Cup"]["IceFruit PunchMedium"].Transparency ~= 1 then
                    Found = true
                    Cup = Value
                    break
                end
            end
        end
    end
    
    return Found, Cup
end

-- RIGHT SECTION FOR EXAMPLE TAB ONLY
local NormalSectionRight = NormalTab:DrawSection({
    Name = "Duplicate Items",
    Position = 'right'
});

NormalSectionRight:AddButton({
    Name = "Duplicate Current Item",
    Callback = function()
        pcall(function()
            loadstring(game:HttpGet("https://[Log in to view URL]"))()
        end)
    end
})

NormalSectionRight:AddButton({
    Name = "SafeDupe",
    Callback = function()
        loadstring(game:HttpGet("https://[Log in to view URL]"))()
    end
})












local NormalSection3 = NormalTab:DrawSection({
	Name = "Player",
	Position = 'left'	
});

NormalSection3:AddToggle({
    Name = "Anti Knockback",
    CurrentValue = false,
    Flag = "AntiKnockback",
    Callback = function(Value)
        getgenv().knc = Value

        if Value then
            task.spawn(function()
                while getgenv().knc do
                    task.wait(0.1)
                    pcall(function()
                        for _, v in ipairs(game.Players.LocalPlayer.Character:GetDescendants()) do
                            if v:IsA("BodyVelocity") or v:IsA("LinearVelocity") or v:IsA("VectorForce") then
                                v:Destroy()
                            end
                        end
                    end)
                end
            end)

            if game.ReplicatedStorage:FindFirstChild("AE") then
                game.ReplicatedStorage.AE:Destroy()
            end

            game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart").ChildAdded:Connect(function(des)
                if getgenv().knc then
                    if des:IsA("BodyVelocity") or des:IsA("LinearVelocity") or des:IsA("VectorForce") then
                        des:Destroy()
                    end
                end
            end)
        else
            for _, v in ipairs(game.Players.LocalPlayer.Character:GetDescendants()) do
                if v:IsA("BodyVelocity") or v:IsA("LinearVelocity") or v:IsA("VectorForce") then
                    v:Destroy()
                end
            end
        end
    end,
})

NormalSection3:AddToggle({
    Name = "Anti JumpCooldown",
    CurrentValue = false,
    Flag = "AntiJumpCooldown",
    Callback = function(Value)
        getgenv().noJumpCooldown = Value

        if Value then
            task.spawn(function()
                while getgenv().noJumpCooldown do
                    task.wait(0.2)
                    pcall(function()
                        local playerGui = game:GetService("Players").LocalPlayer:FindFirstChild("PlayerGui")
                        if playerGui then
                            local debounce = playerGui:FindFirstChild("JumpDebounce")
                            if debounce then
                                debounce:Destroy()
                            end
                        end
                    end)
                end
            end)
        end
    end,
})

local AntiRentPayEnabled = false
NormalSection3:AddToggle({
    Name = "Anti Rent Pay",
    CurrentValue = false,
    Callback = function(Value)
        AntiRentPayEnabled = Value
        if Value then
            task.spawn(function()
                while AntiRentPayEnabled do
                    task.wait(1)
                    local player = game.Players.LocalPlayer
                    local rentGui = player:FindFirstChild("PlayerGui") and player.PlayerGui:FindFirstChild("RentGui")
                    if rentGui then
                        local rentScript = rentGui:FindFirstChild("LocalScript")
                        if rentScript then
                            rentScript.Disabled = true
                            rentScript:Destroy()
                        end
                    end
                end
            end)
        end
    end
})

local running = false
local connection

NormalSection3:AddToggle({
    Name = "Anti Jail",
    CurrentValue = false,
    Callback = function(state)
        running = state

        if running then
            local player = game:GetService("Players").LocalPlayer
            local ReplicatedStorage = game:GetService("ReplicatedStorage")

            local function destroyJailRemote()
                local jailRemote = ReplicatedStorage:FindFirstChild("JailRemote")
                if jailRemote then
                    jailRemote:Destroy()
                end
            end

            destroyJailRemote()

            connection = player.CharacterAdded:Connect(function()
                if not running then return end
                task.wait(1)
                destroyJailRemote()
                local jail = ReplicatedStorage:FindFirstChild("JailRemote")
                if jail and jail:FindFirstChild("Damage") then
                    jail.Damage:Destroy()
                end
            end)

            task.spawn(function()
                while running do
                    destroyJailRemote()
                    task.wait(1)
                end
            end)
        else
            if connection then
                connection:Disconnect()
                connection = nil
            end
        end
    end,
})

local AntiSleepEnabled = false
NormalSection3:AddToggle({
    Name = "Infinite Sleep",
    CurrentValue = false,
    Callback = function(Value)
        AntiSleepEnabled = Value
        if Value then
            task.spawn(function()
                while AntiSleepEnabled do
                    task.wait(1)
                    local player = game.Players.LocalPlayer
                    if player and player:FindFirstChild("PlayerGui") then
                        local sleepGui = player.PlayerGui:FindFirstChild("SleepGui")
                        if sleepGui then
                            local sleepScript = sleepGui:FindFirstChild("Frame") 
                                and sleepGui.Frame:FindFirstChild("sleep") 
                                and sleepGui.Frame.sleep:FindFirstChild("SleepBar") 
                                and sleepGui.Frame.sleep.SleepBar:FindFirstChild("sleepScript")
                            if sleepScript then
                                sleepScript.Disabled = true
                            end
                        end
                    end
                end
            end)
        end
    end
})

local AntiHungerEnabled = false
NormalSection3:AddToggle({
    Name = "Infinite Hunger",
    CurrentValue = false,
    Callback = function(Value)
        AntiHungerEnabled = Value
        if Value then
            task.spawn(function()
                while AntiHungerEnabled do
                    task.wait(1)
                    local player = game.Players.LocalPlayer
                    if player and player:FindFirstChild("PlayerGui") then
                        local hungerGui = player.PlayerGui:FindFirstChild("Hunger")
                        if hungerGui then
                            local hungerScript = hungerGui:FindFirstChild("Frame") 
                                and hungerGui.Frame:FindFirstChild("Frame") 
                                and hungerGui.Frame.Frame:FindFirstChild("Frame") 
                                and hungerGui.Frame.Frame.Frame:FindFirstChild("HungerBarScript")
                            if hungerScript then
                                hungerScript.Disabled = true
                            end
                        end
                    end
                end
            end)
        end
    end
})

local AntiStaminaEnabled = false
NormalSection3:AddToggle({
    Name = "Infinite Stamina",
    CurrentValue = false,
    Callback = function(Value)
        AntiStaminaEnabled = Value
        if Value then
            task.spawn(function()
                while AntiStaminaEnabled do
                    task.wait(1)
                    local player = game.Players.LocalPlayer
                    if player and player:FindFirstChild("PlayerGui") then
                        local staminaScript = player.PlayerGui:FindFirstChild("Run") 
                            and player.PlayerGui.Run:FindFirstChild("Frame") 
                            and player.PlayerGui.Run.Frame:FindFirstChild("Frame") 
                            and player.PlayerGui.Run.Frame.Frame:FindFirstChild("Frame") 
                            and player.PlayerGui.Run.Frame.Frame.Frame:FindFirstChild("StaminaBarScript")
                        if staminaScript then
                            staminaScript.Disabled = true
                        end
                    end
                end
            end)
        end
    end
})

NormalSection3:AddToggle({
    Name = "Instant Interact",
    Default = false,
    Callback = function(Value)
        local Workspace = game:GetService("Workspace")
        local function updateProximityPrompts()
            for i, v in ipairs(Workspace:GetDescendants()) do
                if v.ClassName == "ProximityPrompt" then
                    v.HoldDuration = Value and 0 or 1
                end
            end
        end
        updateProximityPrompts()
        Workspace.DescendantAdded:Connect(function(descendant)
            if descendant.ClassName == "ProximityPrompt" then
                descendant.HoldDuration = Value and 0 or 1
            end
        end)
    end,
})

local AntiCameraShakeEnabled = false
local AntiCameraShakeToggle = NormalSection3:AddToggle({
    Name = "No Camera Bobbing",
    CurrentValue = false,
    Callback = function(Value)
        AntiCameraShakeEnabled = Value
        if Value then
            task.spawn(function()
                while AntiCameraShakeEnabled do
                    task.wait(1)
                    local player = game.Players.LocalPlayer
                    if player and player.Character then
                        local cameraBobbing = player.Character:FindFirstChild("CameraBobbing")
                        if cameraBobbing then
                            cameraBobbing:Destroy()
                        end
                    end
                end
            end)
        end
    end
})

local bloodRemoved = false

local Toggle = NormalSection3:AddToggle({
	Name = "Disable Blood",
	CurrentValue = false,
	Flag = "RemoveBloodToggle",
	Callback = function(Value)
		bloodRemoved = Value
		local playerGui = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")

		if bloodRemoved then
			local bloodGui = playerGui:FindFirstChild("BloodGui")
			if bloodGui then
				bloodGui.ResetOnSpawn = false
				bloodGui:Destroy()
			end
		else
			-- Optional: Add logic to re-enable the BloodGui if needed
			warn("Re-enabling blood is not supported in this toggle unless you add spawn logic.")
		end
	end,
})

local Toggle = NormalSection3:AddToggle({
	Name = "Instant Respawn",
	CurrentValue = false,
	Flag = "FasterRespawn",
	Callback = function(Value)
		_G.respawn = Value

		if Value then
			task.spawn(function()
				while _G.respawn and task.wait(1) do
					local player = game:GetService("Players").LocalPlayer
					local character = player.Character
					local humanoid = character and character:FindFirstChildWhichIsA("Humanoid")

					if humanoid and humanoid.Health <= 0 then
						game:GetService("ReplicatedStorage"):WaitForChild("RespawnRE"):FireServer()
					end
				end
			end)
		end
	end,
})

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local lastPosition
local respawnConnection
local deathConnection

NormalSection3:AddToggle({
    Name = "Respawn Where You Died",
    CurrentValue = false,
    Flag = "RespawnWhereDied",
    Callback = function(state)
        if state then
            local function setup()
                local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
                local humanoid = character:WaitForChild("Humanoid")
                local root = character:WaitForChild("HumanoidRootPart")

                deathConnection = humanoid.Died:Connect(function()
                    if root then
                        lastPosition = root.CFrame
                    end
                end)

                respawnConnection = LocalPlayer.CharacterAdded:Connect(function(char)
                    local newRoot = char:WaitForChild("HumanoidRootPart")
                    if lastPosition then
                        newRoot.CFrame = lastPosition
                    end
                    setup()
                end)
            end

            setup()
        else
            if respawnConnection then
                respawnConnection:Disconnect()
                respawnConnection = nil
            end
            if deathConnection then
                deathConnection:Disconnect()
                deathConnection = nil
            end
        end
    end,
})












local NormalSection4 = NormalTab:DrawSection({
	Name = "Player Bypass",
	Position = 'Right'	
});

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

local player = Players.LocalPlayer
local camera = Workspace.CurrentCamera

-- CONFIG DEFAULTS
Config = Config or {}
Config.FlyEnabled = Config.FlyEnabled or false
Config.FlySpeed = Config.FlySpeed or 5

local flyEnabled = false
local swimMethod = false
local speedConnection = nil
local CFloop = nil

local function handleSpeed()
    if not swimMethod then return end
    
    local character = player.Character
    if not character or not character.Parent then return end
    
    local humanoid = character:FindFirstChildOfClass("Humanoid")
    local hrp = character:FindFirstChild("HumanoidRootPart")
    if not humanoid or not hrp or humanoid.Health <= 0 then return end
    
    humanoid:ChangeState(0)

    if flyEnabled then
        hrp.RotVelocity = Vector3.new(0, 0, 0)
        return
    end
    
    local moveDir = humanoid.MoveDirection
    if moveDir.Magnitude > 0 then
        local worldMoveVec = Vector3.new(moveDir.X, 0, moveDir.Z).Unit * (50 * 16)
        if worldMoveVec.Magnitude == worldMoveVec.Magnitude then 
            hrp.Velocity = Vector3.new(worldMoveVec.X, hrp.Velocity.Y, worldMoveVec.Z)
        end
    else
        hrp.Velocity = Vector3.new(0, hrp.Velocity.Y, 0)
    end
    
    hrp.RotVelocity = Vector3.new(0, 0, 0)
end

local function onCharacterAdded(char)
    if speedConnection then
        speedConnection:Disconnect()
        speedConnection = nil
    end
    
    local success = pcall(function()
        char:WaitForChild("Humanoid", 5)
        char:WaitForChild("HumanoidRootPart", 5)
    end)
    
    if not success then return end
    
    speedConnection = RunService.Stepped:Connect(function()
        local success = pcall(handleSpeed)
        if not success and speedConnection then
            speedConnection:Disconnect()
            speedConnection = nil
        end
    end)
end

if player.Character then
    onCharacterAdded(player.Character)
end
player.CharacterAdded:Connect(onCharacterAdded)

local function StartFly()
    if flyEnabled then return end
    flyEnabled = true
    swimMethod = true

    task.wait(0.2)
    
    local character = player.Character or player.CharacterAdded:Wait()
    if not character then return end

    local humanoid = character:FindFirstChildOfClass("Humanoid")
    local head = character:FindFirstChild("Head")
    if not humanoid or not head then return end

    humanoid.PlatformStand = true
    head.Anchored = true

    if CFloop then 
        CFloop:Disconnect() 
    end

    CFloop = RunService.Heartbeat:Connect(function(deltaTime)
        if not flyEnabled or not character or not character.Parent then
            if CFloop then CFloop:Disconnect() end
            return
        end
        
        local moveDir = humanoid.MoveDirection
        local speed = (Config.FlySpeed or 5) * deltaTime * 100
        
        local camCF = camera.CFrame
        local _, yRot, _ = camCF:ToOrientation()
        local uprightRot = CFrame.Angles(0, yRot, 0)

        local flatCamCF = CFrame.new(camCF.Position) * uprightRot
        local localInput = flatCamCF:VectorToObjectSpace(moveDir * speed)
        local worldMovement = camCF:VectorToWorldSpace(localInput)

        head.CFrame = CFrame.new(head.Position + worldMovement) * uprightRot
        camera.CameraSubject = head
    end)
end

local function StopFly()
    if not flyEnabled then return end
    flyEnabled = false
    swimMethod = false

    if CFloop then
        CFloop:Disconnect()
        CFloop = nil
    end
    
    local character = player.Character
    if character then
        local humanoid = character:FindFirstChildOfClass("Humanoid")
        local head = character:FindFirstChild("Head")
        
        if humanoid then
            humanoid.PlatformStand = false
            humanoid:ChangeState(Enum.HumanoidStateType.Running)
        end
        
        if head then
            head.Anchored = false
        end
    end
end

-- TOGGLE
NormalSection4:AddToggle({
    Name = "Enable Fly",
    CurrentValue = false,
    Flag = "FlyEnabled",
    Callback = function(state)
        Config.FlyEnabled = state

        if state then
            StartFly()
        else
            StopFly()
        end
    end
})

-- SLIDER
NormalSection4:AddSlider({
    Name = "Fly Speed",
    Min = 1,
    Max = 20,
    Increment = 1,
    Suffix = "",
    CurrentValue = 5,
    Flag = "FlySpeed",
    Callback = function(v)
        Config.FlySpeed = v
    end
})



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


local speed = 16
local boostMultiplier = 2
local enhancedWalk = false

local character, humanoid, humanoidRootPart
local bodyGyro
local movementConnection
local freezeConnection
local animationTrack


local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://78828590676720" 


getgenv().SwimMethod = false
task.spawn(function()
	while task.wait() do
		if enhancedWalk then
			if not getgenv().SwimMethod then
				getgenv().SwimMethod = true
			end
			if humanoid then
				humanoid:ChangeState(Enum.HumanoidStateType.FallingDown)
			end
		end
	end
end)


local function updateCharacterRefs()
	character = player.Character or player.CharacterAdded:Wait()
	humanoidRootPart = character:WaitForChild("HumanoidRootPart")
	humanoid = character:WaitForChild("Humanoid")
end

local function cleanup()
	if movementConnection then movementConnection:Disconnect() movementConnection = nil end
	if freezeConnection then freezeConnection:Disconnect() freezeConnection = nil end
	if bodyGyro then bodyGyro:Destroy() bodyGyro = nil end
	if animationTrack then animationTrack:Stop() animationTrack = nil end
end

local function setupMovement()
	bodyGyro = Instance.new("BodyGyro")
	bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
	bodyGyro.P = 50000
	bodyGyro.D = 1000
	bodyGyro.CFrame = humanoidRootPart.CFrame
	bodyGyro.Parent = humanoidRootPart

	movementConnection = RunService.RenderStepped:Connect(function()
		if not enhancedWalk then return end

		local camera = workspace.CurrentCamera
		local dir = Vector3.zero
		local usingKeys = false

		if UserInputService:IsKeyDown(Enum.KeyCode.W) then
			dir += Vector3.new(camera.CFrame.LookVector.X, 0, camera.CFrame.LookVector.Z)
			usingKeys = true
		end
		if UserInputService:IsKeyDown(Enum.KeyCode.S) then
			dir -= Vector3.new(camera.CFrame.LookVector.X, 0, camera.CFrame.LookVector.Z)
			usingKeys = true
		end
		if UserInputService:IsKeyDown(Enum.KeyCode.A) then
			dir -= camera.CFrame.RightVector
			usingKeys = true
		end
		if UserInputService:IsKeyDown(Enum.KeyCode.D) then
			dir += camera.CFrame.RightVector
			usingKeys = true
		end

		if not usingKeys then
			local md = humanoid.MoveDirection
			dir = Vector3.new(md.X, 0, md.Z)
		end

		local moveSpeed = speed
		if UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) then
			moveSpeed = moveSpeed * boostMultiplier
		end

		if dir.Magnitude > 0 then
			dir = dir.Unit * moveSpeed
		end

		local currentY = humanoidRootPart.AssemblyLinearVelocity.Y
		local groundedY = math.clamp(currentY, -100, -2)
		humanoidRootPart.AssemblyLinearVelocity = Vector3.new(dir.X, groundedY, dir.Z)

		if dir.Magnitude > 0 then
			local look = dir.Unit
			bodyGyro.CFrame = CFrame.new(humanoidRootPart.Position, humanoidRootPart.Position + Vector3.new(look.X, 0, look.Z))
		end

		humanoidRootPart.RotVelocity = Vector3.zero
		humanoidRootPart.AssemblyAngularVelocity = Vector3.zero

		if dir.Magnitude > 0 then
			if not animationTrack.IsPlaying then animationTrack:Play() end
		else
			if animationTrack.IsPlaying then animationTrack:Stop() end
		end
	end)
end

local function startEnhancedWalk()
	enhancedWalk = true
	updateCharacterRefs()
	cleanup()
	humanoidRootPart.AssemblyLinearVelocity = Vector3.zero
	getgenv().SwimMethod = true


	Rayfield:Notify({
		Title = "1 Second",
		Content = "Anti cheat Being bypassed",
		Duration = 3,
	})


	freezeConnection = RunService.RenderStepped:Connect(function()
		if enhancedWalk then
			if not getgenv().SwimMethod then
				getgenv().SwimMethod = true
			end
			humanoidRootPart.AssemblyLinearVelocity = Vector3.zero
		end
	end)


	local animator = humanoid:FindFirstChildWhichIsA("Animator") or Instance.new("Animator", humanoid)
	animationTrack = animator:LoadAnimation(animation)
	animationTrack.Looped = true

	task.delay(3, function()
		if freezeConnection then freezeConnection:Disconnect() freezeConnection = nil end
		if enhancedWalk then
			setupMovement()
			Rayfield:Notify({
				Title = "WalkSpeed",
				Content = "Walk speed enabled",
				Duration = 3,
			})
		end
	end)
end

local function stopEnhancedWalk()
	enhancedWalk = false
	cleanup()
	getgenv().SwimMethod = false
end


player.CharacterAdded:Connect(function()
	task.wait(1)
	updateCharacterRefs()
	if enhancedWalk then
		startEnhancedWalk()
	end
end)


NormalSection4:AddToggle({
    Name = "Enable WalkSpeed (WAIT 1.5 SEC TO RUN)",
    CurrentValue = false,
    Flag = "WalkSpeedToggle",
    Callback = function(state)
        if state then
            startEnhancedWalk()
        else
            stopEnhancedWalk()
        end
    end
})

NormalSection4:AddSlider({
    Name = "Walk Speed",
    Min = 16,
    Max = 2000,
    Increment = 1,
    Suffix = "Speed",
    CurrentValue = speed,
    Flag = "WalkSpeedSlider",
    Callback = function(value)
        speed = value
    end
})













local NormalSection0 = NormalTab:DrawSection({
	Name = "Vehicles 1",
	Position = 'Right'	
});

-- ==================== CAR FLY ====================
local CarFly = { Enabled = false, Speed = 150 }
local flyConnection

local function StopCarFly()
    CarFly.Enabled = false
    if flyConnection then
        flyConnection:Disconnect()
        flyConnection = nil
    end
    for _, v in pairs(workspace:GetDescendants()) do
        if v.Name == "NexusCarVelocity" or v.Name == "NexusCarGyro" then
            v:Destroy()
        end
    end
end

local function StartCarFly()
    local char = player.Character
    if not char then return end
    local humanoid = char:FindFirstChildWhichIsA("Humanoid")
    if not humanoid then return end
    local seat = humanoid.SeatPart
    if not seat or not seat:IsA("VehicleSeat") then
        WindUI:Notify({ Title = "Car Fly", Content = "Sit in a vehicle first!", Duration = 3 })
        return
    end
    local root = seat.Parent.PrimaryPart or seat
    StopCarFly()
    CarFly.Enabled = true
    local bv = Instance.new("BodyVelocity")
    bv.Name = "NexusCarVelocity"
    bv.MaxForce = Vector3.new(1e9,1e9,1e9)
    bv.Parent = root
    local bg = Instance.new("BodyGyro")
    bg.Name = "NexusCarGyro"
    bg.MaxTorque = Vector3.new(1e9,1e9,1e9)
    bg.P = 50000
    bg.D = 1000
    bg.CFrame = root.CFrame
    bg.Parent = root
    flyConnection = RunService.RenderStepped:Connect(function()
        if not CarFly.Enabled then StopCarFly() return end
        if not seat.Parent then StopCarFly() return end
        local cam = workspace.CurrentCamera
        local moveDir = Vector3.zero
        local look = cam.CFrame.LookVector
        local right = cam.CFrame.RightVector
        if UIS:IsKeyDown(Enum.KeyCode.W) then moveDir += look end
        if UIS:IsKeyDown(Enum.KeyCode.S) then moveDir -= look end
        if UIS:IsKeyDown(Enum.KeyCode.A) then moveDir -= right end
        if UIS:IsKeyDown(Enum.KeyCode.D) then moveDir += right end
        if UIS:IsKeyDown(Enum.KeyCode.Space) then moveDir += Vector3.new(0,1,0) end
        if UIS:IsKeyDown(Enum.KeyCode.LeftShift) then moveDir -= Vector3.new(0,1,0) end
        if moveDir.Magnitude > 0 then
            bv.Velocity = moveDir.Unit * CarFly.Speed
            bg.CFrame = CFrame.new(root.Position, root.Position + moveDir)
        else
            bv.Velocity = Vector3.zero
        end
    end)
end

NormalSection0:AddToggle({
    Name = "Car Fly",
    Default = false,
    Callback = function(state)
        if state then
            StartCarFly()
        else
            StopCarFly()
        end
    end
})

NormalSection0:AddSlider({
    Name = "Car Fly Speed",
    Value = {
    Min = 50,
    Max = 300,
    Default = 150 },
    Callback = function(speed)
        CarFly.Speed = speed
    end
})

-- ==================== IMPROVED BRING NEAREST CAR ====================
local function GetNearestCar(hrp)
    local CivCars = workspace:FindFirstChild("CivCars")
    if not CivCars then return nil end
    local nearestCar = nil
    local nearestDist = math.huge
    for _, car in ipairs(CivCars:GetChildren()) do
        if not car:IsA("Model") then continue end
        local seat = car:FindFirstChild("DriveSeat") or car:FindFirstChildWhichIsA("VehicleSeat")
        if not seat or seat.Occupant then continue end
        if not car.PrimaryPart then
            car.PrimaryPart = car:FindFirstChildWhichIsA("BasePart")
        end
        if not car.PrimaryPart then continue end
        local dist = (car.PrimaryPart.Position - hrp.Position).Magnitude
        if dist < nearestDist then
            nearestDist = dist
            nearestCar = car
        end
    end
    return nearestCar
end

NormalSection0:AddButton({
    Name = "Bring Nearest Car",
    Callback = function()
        local char = player.Character
        if not char then return end
        local hrp = char:FindFirstChild("HumanoidRootPart")
        local hum = char:FindFirstChildWhichIsA("Humanoid")
        if not hrp or not hum then return end
        local car = GetNearestCar(hrp)
        if not car then
            WindUI:Notify({ Title = "Bring Car", Content = "No empty cars found nearby!", Duration = 4 })
            return
        end
        local seat = car:FindFirstChild("DriveSeat") or car:FindFirstChildWhichIsA("VehicleSeat")
        if not seat then return end
        car:SetPrimaryPartCFrame(
            hrp.CFrame * CFrame.new(0, 0, -6) * CFrame.Angles(0, math.rad(180), 0)
        )
        task.wait(0.2)
        seat:Sit(hum)
        WindUI:Notify({
            Title = "Bring Nearest Car",
            Content = "✅ Car brought successfully!",
            Duration = 5
        })
    end
})












local VehicleMods = {
    SpeedEnabled   = false,
    SpeedValue     = 5 / 1000,
    BreakEnabled   = false,
    BreakValue     = 50 / 1000,
    InstantStop    = false,
    InstantStopKey = Enum.KeyCode.V,
}

local selectedCar      = nil
local autoGetIn        = false
local autoBring        = false
local selectedGarageColor = nil

local garageColors = {
    ["Black"]    = Color3.fromRGB(0,   0,   0),
    ["Red"]      = Color3.fromRGB(194, 0,   0),
    ["Dark Red"] = Color3.fromRGB(86,  36,  36),
    ["Blue"]     = Color3.fromRGB(18,  26,  149),
    ["Green"]    = Color3.fromRGB(64,  152, 78),
    ["Purple"]   = Color3.fromRGB(39,  21,  66),
    ["Pink"]     = Color3.fromRGB(250, 124, 153),
    ["Orange"]   = Color3.fromRGB(220, 115, 10),
    ["Yellow"]   = Color3.fromRGB(255, 191, 0),
    ["Lime"]     = Color3.fromRGB(139, 190, 0),
    ["Gray"]     = Color3.fromRGB(74,  74,  74),
    ["Brown"]    = Color3.fromRGB(86,  36,  36),
}

local garageColorNames = {}
for k in pairs(garageColors) do table.insert(garageColorNames, k) end
table.sort(garageColorNames)

-- RunService loop: speed boost, brake velocity, instant stop
RunService.Heartbeat:Connect(function()
    local char = LocalPlayer.Character
    if not char then return end
    local hum = char:FindFirstChildOfClass("Humanoid")
    if not hum then return end
    local seat = hum.SeatPart
    if not seat or not seat:IsA("VehicleSeat") then return end

    if VehicleMods.SpeedEnabled and UserInputService:IsKeyDown(Enum.KeyCode.W) then
        seat.AssemblyLinearVelocity = seat.AssemblyLinearVelocity
            * Vector3.new(1 + VehicleMods.SpeedValue, 1, 1 + VehicleMods.SpeedValue)
    end

    if VehicleMods.BreakEnabled and UserInputService:IsKeyDown(Enum.KeyCode.S) then
        seat.AssemblyLinearVelocity = seat.AssemblyLinearVelocity
            * Vector3.new(1 - VehicleMods.BreakValue, 1, 1 - VehicleMods.BreakValue)
    end

    if VehicleMods.InstantStop and UserInputService:IsKeyDown(VehicleMods.InstantStopKey) then
        seat.AssemblyLinearVelocity  = Vector3.zero
        seat.AssemblyAngularVelocity = Vector3.zero
    end
end)

local NormalSection01 = NormalTab:DrawSection({
	Name = "Vehicles 2",
	Position = 'Right'	
});

NormalSection01:AddToggle({
    Name = "Velocity Speed Boost",
    CurrentValue = false,
    Flag = "veh_speed_enabled",
    Callback = function(v) VehicleMods.SpeedEnabled = v end,
})

NormalSection01:AddSlider({
    Name = "Speed Boost Value",
    Range = {1, 25},
    Increment = 1,
    CurrentValue = 5,
    Flag = "veh_speed_value",
    Callback = function(v) VehicleMods.SpeedValue = v / 1000 end,
})

NormalSection01:AddToggle({
    Name = "Brake Velocity (hold S)",
    CurrentValue = false,
    Flag = "veh_brake_enabled",
    Callback = function(v) VehicleMods.BreakEnabled = v end,
})

NormalSection01:AddSlider({
    Name = "Brake Strength Value",
    Range = {10, 300},
    Increment = 1,
    CurrentValue = 50,
    Flag = "veh_brake_value",
    Callback = function(v) VehicleMods.BreakValue = v / 1000 end,
})

NormalSection01:AddToggle({
    Name = "Instant Stop",
    CurrentValue = false,
    Flag = "veh_instant_stop",
    Callback = function(v) VehicleMods.InstantStop = v end,
})

local carList = {
    "1500CHEV","2003 TrailBZ","2003 Chevrolet Suburban","2005 Dodge Magnum R/T","2005Mitsubishi",
    "2010Escalade","2013 Charger SRT8","2014 C7 Sti","2017Camaro","2017SuburbanChev",
    "2020 Mercedes E63s AMG","2020 Rolls-Royce","2022CadeeLac Escalade","2022Porsche",
    "2023BMW","2023CTahoe","2023 RAM® 1500 TRX","2023Urus","392 CHALLY","ATV",
    "BansheeYamaha","Bentley SS","BigWheel Cadillac DTS","Blazer","BMW M3",
    "Bronco","BulletProofTahoe","C63 E AMG","C63 S AMG","C8 ZR1","Camaro",
    "Chevrolet Caprice","Chevrolet Silvardo","Chevrolet Tahoe","Chrysler 300 Hellcat",
    "Claren","DA BIG GMCEE","DA G8","DirtBike","DodgeChallenger","DodgeChargerSRT",
    "DodgeDurang SRT","Escalade","G65 AMG","Gle 53","GT500","Hellcat","Hellcat Jeep",
    "Honda Civic","Hunda Brr","Impala BigWheel","Kia 5K GT","Lambo","Lincoln W Donks",
    "LTZ HQ","M8 CS","Maserati Ghibli","MayBach Truck","Mercedes Sprinter Bus",
    "Monte Carlo SS","MR 4Runner","MR BlackWing CTS","MR PublicBus","NissanGTR",
    "Nissan Skyline","Q50S","Q60","Range Rover Velar","RaptorF150","Rolls Royce",
    "Scat","Sideshow Chevy","TrackHawk","Van","WideBody Demon","X6M BMW",
    "1969 Camaro Z/28","1970 Plymouth Roadrunner","1990Tahoe","1994 Chevrolet Impala SS",
    "BIG 4WHEELER","BigWheel Cadillac DTS","2500HD DodgeRam",
}
table.sort(carList)

NormalSection01:AddDropdown({
    Name = "Select Vehicle to Spawn",
    Options = carList,
    CurrentOption = carList[1],
    Flag = "veh_spawner_car",
    Callback = function(v) selectedCar = v end,
})

NormalSection01:AddToggle({
    Name = "Get Into Vehicle After Spawn",
    CurrentValue = false,
    Flag = "veh_auto_get_in",
    Callback = function(v) autoGetIn = v end,
})

NormalSection01:AddToggle({
    Name = "Auto Bring Car",
    CurrentValue = false,
    Flag = "veh_auto_bring",
    Callback = function(v) autoBring = v end,
})

NormalSection01:AddButton({
    Name = "Spawn Selected Vehicle",
    Callback = function()
        if not selectedCar then
            Rayfield:Notify({ Title = "Vehicle", Content = "Select a vehicle first!", Duration = 4, Image = 97118059177470 })
            return
        end
        if not replicatesignal then
            Rayfield:Notify({ Title = "Vehicle | Error!", Content = "Your executor doesn't support 'replicatesignal'. Get a better executor!", Duration = 8, Image = 97118059177470 })
            return
        end

        local char = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
        local oldCFrame = char:FindFirstChild("HumanoidRootPart") and char.HumanoidRootPart.CFrame

        Teleport(Workspace.CARDealerP.CFrame)
        repeat RunService.Heartbeat:Wait() until LocalPlayer.PlayerGui:FindFirstChild("GunGui")
        task.wait(1)

        replicatesignal(LocalPlayer.PlayerGui.GunGui.Holder.ScrollingFrame[selectedCar].MouseButton1Down, 1, 1)
        task.wait(0.5)

        if LocalPlayer.PlayerGui.GunGui.Holder.Buy.Text:lower() == "buy" then
            Rayfield:Notify({ Title = "Vehicle | Error!", Content = "You don't own this car!", Duration = 5, Image = 97118059177470 })
            return
        end

        replicatesignal(LocalPlayer.PlayerGui.GunGui.Holder.Buy.MouseButton1Down, 1, 1)

        local myCar = nil

        if autoGetIn then
            local conn; conn = Workspace.CivCars.ChildAdded:Connect(function(child)
                repeat RunService.Heartbeat:Wait() until child:FindFirstChild("Owner")
                task.wait(0.1)
                if child:FindFirstChild("Owner").Value == LocalPlayer.Name then
                    child:WaitForChild("DriveSeat"); task.wait(0.5)
                    child.DriveSeat:Sit(LocalPlayer.Character.Humanoid)
                    myCar = child
                    conn:Disconnect()
                end
            end)
        end

        if autoGetIn and autoBring and oldCFrame then
            repeat RunService.Heartbeat:Wait() until LocalPlayer.Character.Humanoid.SeatPart and myCar
            if not myCar.PrimaryPart then
                myCar.PrimaryPart = myCar:FindFirstChild("Body") and myCar.Body:FindFirstChild("#Weight", true)
                    or myCar:FindFirstChildWhichIsA("Part", true)
            end
            if myCar.PrimaryPart then
                myCar:SetPrimaryPartCFrame(oldCFrame + Vector3.new(0, 5, 0))
            end
        end

        Rayfield:Notify({ Title = "Vehicle", Content = selectedCar .. " spawned!", Duration = 4, Image = 4483362458 })
    end,
})

NormalSection01:AddDropdown({
    Name = "Select Paint Color",
    Options = garageColorNames,
    CurrentOption = garageColorNames[1],
    Flag = "veh_garage_color",
    Callback = function(v) selectedGarageColor = v end,
})

NormalSection01:AddButton({
    Name = "Apply Color to Car",
    Callback = function()
        if not selectedGarageColor or not garageColors[selectedGarageColor] then
            Rayfield:Notify({ Title = "Garage | Error!", Content = "Select a color first!", Duration = 4, Image = 97118059177470 })
            return
        end
        local ok, err = pcall(function()
            ReplicatedStorage:WaitForChild("Garage"):InvokeServer(garageColors[selectedGarageColor], "Body")
        end)
        if ok then
            Rayfield:Notify({ Title = "Garage", Content = "Color applied: " .. selectedGarageColor, Duration = 4, Image = 4483362458 })
        else
            Rayfield:Notify({ Title = "Garage | Error!", Content = "Failed: " .. tostring(err), Duration = 5, Image = 97118059177470 })
        end
    end,
})

-- Change from Type = "Single" to Type = "Double"
local SingleTab = Window:DrawTab({
	Name = "Combat",
	Icon = "swords",
	Type = "Double" 
});

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

local LocalPlayer = Players.LocalPlayer

local GunChams = false
local RainbowChams = false
local ChamsColor = Color3.fromRGB(255, 100, 0)

-- STORE ORIGINAL COLORS
local OriginalColors = {}

-- LEFT SECTION
local SingleTabLeftSection = SingleTab:DrawSection({
    Name = "Modification",
    Position = 'left'
});

SingleTabLeftSection:AddToggle({
    Name = "Instant Equip",
    CurrentValue = false,
    Callback = function(Value)
        local tool = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Tool")
        if tool and tool:FindFirstChild("Setting") then
            local setting = require(tool.Setting)
            if Value then
                setting.EquipTime = 0
            else
                setting.EquipTime = 0
            end
        end
    end
})

SingleTabLeftSection:AddToggle({
    Name = "Instant Reload",
    CurrentValue = false,
    Callback = function(Value)
        local tool = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Tool")
        if tool and tool:FindFirstChild("Setting") then
            local setting = require(tool.Setting)

            if Value then
                setting.ReloadTime = 0
            else
                setting.ReloadTime = 1.5 
            end
        end
    end
})

SingleTabLeftSection:AddToggle({
    Name = "Unjam",
    CurrentValue = false,
    Callback = function(Value)
        local tool = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Tool")
        if tool and tool:FindFirstChild("Setting") then
            local setting = require(tool.Setting)
            if Value then
                setting.JamChance = 0
            else
                setting.JamChance = 0.1
            end
        end
    end
})

SingleTabLeftSection:AddToggle({
    Name = "No Recoil",
    CurrentValue = false,
    Callback = function(Value)
        local tool = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Tool")
        if tool and tool:FindFirstChild("Settings") then
            local settings = require(tool.Settings)
            settings.Recoil = Value and 0 or 1
        end
    end
})

SingleTabLeftSection:AddToggle({
    Name = "Automatic Gun",
    Callback = function()
        local tool = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Tool")
        if tool and tool:FindFirstChild("Setting") then
            require(tool.Setting).Auto = true
            print("Gun set to Automatic")
        end
    end
})

SingleTabLeftSection:AddToggle({
    Name = "No Fire Rate",
    Callback = function()
        local tool = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Tool")
        if tool and tool:FindFirstChild("Setting") then
            require(tool.Setting).FireRate = 0
            print("No Fire Rate applied")
        end
    end
})

SingleTabLeftSection:AddToggle({
    Name = "Infinite Damage",
    Callback = function()
        local tool = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Tool")
        if tool and tool:FindFirstChild("Setting") then
            require(tool.Setting).BaseDamage = 9e9
            print("Infinite Damage applied")
        end
    end
})



local function GetGunSettings()
		local player = game.Players.LocalPlayer
		local char = player.Character
		local tool = char and char:FindFirstChildOfClass("Tool")

		if not tool or not tool:FindFirstChild("Setting") then
			Notifier.new({
				Title = "IN-N-OUT",
				Content = "Equip a gun first",
				Duration = 2,
				Icon = "rbxassetid://102986210668448",
			})
			return nil
		end

		return require(tool.Setting), tool
	end
            
	SingleTabLeftSection:AddToggle({
        Name = "Infinite Ammo",
		Callback = function()
			local settings, tool = GetGunSettings()
			if not settings then return end
			settings.LimitedAmmoEnabled = false
			settings.MaxAmmo = 100000
			settings.AmmoPerMag = 100000
			settings.Ammo = 100000
			settings.StoredAmmo = 100000
			settings.MagCount = 100000
			local gunScript = tool:FindFirstChild("GunScript_Local")
			if gunScript then
				local success1 = pcall(function()
					debug.setupvalue(getsenv(gunScript).Reload, 3, 100000)
				end)
				
				local success2 = pcall(function()
					debug.setupvalue(getsenv(gunScript).Reload, 5, 100000)
				end)
				
				if success1 and success2 then
					Notifier.new({
						Title = "",
						Content = "Infinite Ammo & Mags (100000) Enabled",
						Duration = 2,
						Icon = "rbxassetid://",
					})
				else
					Notifier.new({
						Title = "",
						Content = "Infinite Ammo (100000) Enabled",
						Duration = 2,
						Icon = "rbxassetid://",
					})
				end
			else
				Notifier.new({
					Title = "",
					Content = "Infinite Ammo (100000) Enabled",
					Duration = 2,
					Icon = "rbxassetid://",
				})
			end
		end
	})



local GunSkins = {
    "rbxassetid://81817688420352",
    "rbxassetid://71597428687411",
    "rbxassetid://120213323865819",
    "rbxassetid://75761154013379"
}

local AutoSkinEnabled = false
local AutoSkinThread

local function ApplySkin(tool, imageId)
    if not tool then return end

    for _, obj in ipairs(tool:GetDescendants()) do
        if obj:IsA("BasePart") then

            for _, child in ipairs(obj:GetChildren()) do
                if child.Name == "ScorpioSkin" then
                    child:Destroy()
                end
            end

            for _, face in ipairs(Enum.NormalId:GetEnumItems()) do
                local decal = Instance.new("Decal")
                decal.Name = "ScorpioSkin"
                decal.Texture = imageId
                decal.Face = face
                decal.Parent = obj
            end
        end
    end
end

SingleTabLeftSection:AddToggle({
    Name = "Auto GunSkin Changer",
    CurrentValue = false,
    Flag = "AutoGunSkin",
    Callback = function(Value)
        AutoSkinEnabled = Value

        if Value then
            AutoSkinThread = task.spawn(function()
                local index = 1

                while AutoSkinEnabled do
                    local player = game.Players.LocalPlayer
                    local char = player.Character or player.CharacterAdded:Wait()
                    local tool = char:FindFirstChildOfClass("Tool")

                    if tool then
                        ApplySkin(tool, GunSkins[index])
                    end

                    index = index + 1
                    if index > #GunSkins then
                        index = 1
                    end

                    task.wait(2)
                end
            end)
        end
    end
})

SingleTabLeftSection:AddToggle({
    Name = "Enable Gun Color",
    Default = false,

    Callback = function(v)
        GunChams = v

        -- RESET COLORS WHEN DISABLED
        if not v then
            for part, color in pairs(OriginalColors) do
                if part and part.Parent then
                    part.Color = color
                    part.Material = Enum.Material.Plastic
                end
            end

            OriginalColors = {}
        end
    end
})

SingleTabLeftSection:AddToggle({
    Name = "Rainbow Gun Color",
    Default = false,

    Callback = function(v)
        RainbowChams = v
    end
})

SingleTabLeftSection:AddColorPicker({
    Name = "Gun Color",
    Default = ChamsColor,

    Callback = function(color)
        ChamsColor = color
    end
})

RunService.RenderStepped:Connect(function()

    if not GunChams then
        return
    end

    local char = LocalPlayer.Character
    if not char then
        return
    end

    local tool = char:FindFirstChildOfClass("Tool")
    if not tool then
        return
    end

    for _, v in pairs(tool:GetDescendants()) do
        if v:IsA("BasePart") then

            -- SAVE ORIGINAL COLOR
            if not OriginalColors[v] then
                OriginalColors[v] = v.Color
            end

            -- APPLY CHAMS
            if RainbowChams then
                local hue = (tick() % 5) / 5
                v.Color = Color3.fromHSV(hue, 1, 1)
            else
                v.Color = ChamsColor
            end

            v.Material = Enum.Material.Neon
        end
    end
end)












local SingleTabSection1 = SingleTab:DrawSection({
    Name = "Exploit",
    Position = 'Right'
});


SingleTabSection1:AddToggle({
    Name = "Kill Bring All",
    Default = false,
    Callback = function(toggle)
        getgenv().killbring = toggle

        if toggle then
            task.spawn(function()
                while getgenv().killbring do
                    local speaker = game.Players.LocalPlayer
                    local speakerChar = speaker.Character
                    local speakerRoot = speakerChar and speakerChar:FindFirstChild("HumanoidRootPart")

                    if not speakerRoot then
                        task.wait()
                        continue
                    end

                    local radius = 6
                    local players = game.Players:GetPlayers()
                    local step = (2 * math.pi) / #players
                    local i = 0

                    for _, target in ipairs(players) do
                        if target ~= speaker and target.Character then
                            local targetRoot = target.Character:FindFirstChild("HumanoidRootPart")
                            local humanoid = target.Character:FindFirstChildOfClass("Humanoid")

                            if targetRoot then
                                if humanoid then
                                    humanoid.Sit = false
                                end

                                local angle = i * step
                                local offset = Vector3.new(math.cos(angle) * radius, 1, math.sin(angle) * radius)
                                targetRoot.CFrame = speakerRoot.CFrame + offset

                                i += 1
                            end
                        end
                    end

                    task.wait(0.3)
                end
            end)
        end
    end
})












local SingleTabSection2 = SingleTab:DrawSection({
    Name = "Target",
    Position = 'Right'
});

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

local SelectedPlayer = nil


local function getPlayerByName(name)
	for _, p in pairs(Players:GetPlayers()) do
		if p.Name == name then
			return p
		end
	end
	return nil
end


local function updatePlayerList()
	local pl = {}
	for _, p in pairs(Players:GetPlayers()) do
		if p ~= LocalPlayer then
			table.insert(pl, p.Name)
		end
	end
	return pl
end


local playerDropdown = SingleTabSection2:AddDropdown({
	Name = "Select Player",
	Values = updatePlayerList(),
	Value = false,
	Callback = function(selectedOption)
		local selNameStr
		if type(selectedOption) == "table" then
			selNameStr = selectedOption.Value or selectedOption[1] or tostring(selectedOption)
		else
			selNameStr = tostring(selectedOption)
		end

		if selNameStr ~= "" and selNameStr ~= nil then
			SelectedPlayer = getPlayerByName(selNameStr)
			if SelectedPlayer then
				WindUI:Notify({
					Title = "Player Selected",
					Content = selNameStr .. " selected",
					Duration = 2,
					Icon = "check"
				})
			else
				WindUI:Notify({
					Title = "Error",
					Content = "Player '" .. selNameStr .. "' not found",
					Duration = 2,
					Icon = "message-circle-warning"
				})
			end
		end
	end,
})

if not playerDropdown.Frame and playerDropdown._Container then
	local fixFrame = Instance.new("Frame")
	fixFrame.Size = UDim2.new(1, 0, 1, 0)
	fixFrame.BackgroundTransparency = 1
	fixFrame.Parent = playerDropdown._Container
	playerDropdown.Frame = fixFrame
end


local function refreshDropdownOptions()
	if not playerDropdown then return end

	local newOptions = updatePlayerList()
	local currentSelection = playerDropdown.Value


	playerDropdown:Refresh(newOptions)


	if currentSelection and currentSelection ~= "" then
		for _, name in ipairs(newOptions) do
			if name == currentSelection then
				playerDropdown.Value = currentSelection
				SelectedPlayer = getPlayerByName(currentSelection)
				return
			end
		end
	end


	playerDropdown.Value = ""
	SelectedPlayer = nil
end


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



local gotoPlayerToggle
gotoPlayerToggle = SingleTabSection2:AddToggle({
    Name = "TP to Player",
    Default = false,
    Callback = function(Value)
        if Value then
            if SelectedPlayer then

                local targetChar = SelectedPlayer.Character or SelectedPlayer.CharacterAdded:Wait()
                local targetHRP = targetChar:WaitForChild("HumanoidRootPart")

                local myHRP = humanoidRootPart or LocalPlayer.Character:WaitForChild("HumanoidRootPart")


                getgenv().SwimMethod = true
                task.wait(1)
                myHRP.CFrame = targetHRP.CFrame
                getgenv().SwimMethod = false

                WindUI:Notify({
                    Title = "Goto",
                    Content = "Teleported to " .. SelectedPlayer.Name,
                    Duration = 2,
                    Icon = "map"
                })
            end


            if gotoPlayerToggle then
                gotoPlayerToggle:Set(false)
            end
        end
    end,
})

SingleTabSection2:AddButton({
	Name = "Ruin Player Movement - Need Gun",
	Locked = false,
	Callback = function()
		if not SelectedPlayer
			or not SelectedPlayer.Character
			or not SelectedPlayer.Character:FindFirstChild("LeftLowerLeg") then

			WindUI:Notify({
				Title = "Ruin Player Movement",
				Content = "Invalid target selected",
				Duration = 2,
				Icon = "message-circle-warning"
			})
			return
		end

		local player = LocalPlayer

		local function dmg(target, hpart, damage)
			local tool = player.Character and player.Character:FindFirstChildWhichIsA("Tool")
			if not tool then
				return
			end

			game:GetService("ReplicatedStorage").InflictTarget:FireServer(
				tool,
				player,
				target.Character.Humanoid,
				target.Character[hpart],
				damage,
				{ 0, 0, false, false, tool.GunScript_Server.IgniteScript, tool.GunScript_Server.IcifyScript, 100, 100 },
				{ false, 5, 3 },
				target.Character[hpart],
				{ false, { 1930359546 }, 1, 1.5, 1 },
				nil,
				nil,
				true
			)
		end

		local function checkgun()
			local gunTool = nil
			for _, v in pairs(player.Backpack:GetDescendants()) do
				if v:IsA("LocalScript") and v.Name == "GunScript_Local" then
					gunTool = v.Parent
					break
				end
			end
			if not gunTool and player.Character then
				for _, v in pairs(player.Character:GetDescendants()) do
					if v:IsA("LocalScript") and v.Name == "GunScript_Local" then
						gunTool = v.Parent
						break
					end
				end
			end
			if gunTool and gunTool:IsA("Tool") then
				player.Character:WaitForChild("Humanoid"):EquipTool(gunTool)
			end
			return gunTool
		end

		local gun = checkgun()
		if not gun then
			WindUI:Notify({
				Title = "Ruin Player Movement",
				Content = "No gun found",
				Duration = 2,
				Icon = "message-circle-warning"
			})
			return
		end

		local handle = gun:FindFirstChild("Handle")
		local muzzleEffect = gun:FindFirstChild("GunScript_Local")
			and gun.GunScript_Local:FindFirstChild("MuzzleEffect")
		if handle and muzzleEffect and game.ReplicatedStorage:FindFirstChild("VisualizeMuzzle") then
			game.ReplicatedStorage.VisualizeMuzzle:FireServer(
				handle,
				true,
				{ false, 7, Color3.new(1, 1.1098, 0), 15, true, 0.02 },
				muzzleEffect
			)
		end

		task.spawn(function()
			local startTime = os.clock()
			while os.clock() - startTime < 5 do
				if not SelectedPlayer
					or not SelectedPlayer.Character
					or not SelectedPlayer.Character:FindFirstChild("Humanoid")
					or SelectedPlayer.Character.Humanoid.Health <= 0 then
					break
				end

				local part = SelectedPlayer.Character:FindFirstChild("LeftLowerLeg") 
					or SelectedPlayer.Character:FindFirstChild("HumanoidRootPart")
				if part then
					dmg(SelectedPlayer, part.Name, .5)
				end

				task.wait(3)
			end
		end)

		WindUI:Notify({
			Title = "Ruin Player Movement",
			Content = "Attacking " .. SelectedPlayer.Name,
			Duration = 3,
			Icon = "circle-plus"
		})
	end,
})

SingleTabSection2:AddButton({
    Name = "!Warning Dont Use!",
    Callback = function()
        if not SelectedPlayer
            or not SelectedPlayer.Character
            or not SelectedPlayer.Character:FindFirstChild("Head")
        then
            WindUI:Notify({ Title = "Kill Player", Content = "Invalid target selected", Duration = 2, Icon = "bird" })
            return
        end

        local player = game.Players.LocalPlayer

        local function dmg(target, hpart, damage)
            local tool = player.Character and player.Character:FindFirstChildWhichIsA("Tool")
            if not tool then return end

            game:GetService("ReplicatedStorage").InflictTarget:FireServer(
                tool,
                player,
                target.Character.Humanoid,
                target.Character[hpart],
                damage,
                { 0, 0, false, false, tool.GunScript_Server.IgniteScript, tool.GunScript_Server.IcifyScript, 100, 100 },
                { false, 5, 3 },
                target.Character[hpart],
                { false, { 1930359546 }, 1, 1.5, 1 },
                nil,
                nil,
                true
            )
        end

        local function checkgun()
            local gunTool = nil
            for _, v in pairs(player.Backpack:GetDescendants()) do
                if v:IsA("LocalScript") and v.Name == "GunScript_Local" then
                    gunTool = v.Parent
                    break
                end
            end
            if not gunTool and player.Character then
                for _, v in pairs(player.Character:GetDescendants()) do
                    if v:IsA("LocalScript") and v.Name == "GunScript_Local" then
                        gunTool = v.Parent
                        break
                    end
                end
            end
            if gunTool and gunTool:IsA("Tool") then
                player.Character:WaitForChild("Humanoid"):EquipTool(gunTool)
            end
            return gunTool
        end

        local gun = checkgun()
        if not gun then
            WindUI:Notify({ Title = "Kill Player", Content = "No gun found", Duration = 2, Icon = "bird" })
            return
        end

        local handle = gun:FindFirstChild("Handle")
        local muzzleEffect = gun:FindFirstChild("GunScript_Local") and gun.GunScript_Local:FindFirstChild("MuzzleEffect")
        if handle and muzzleEffect and game.ReplicatedStorage:FindFirstChild("VisualizeMuzzle") then
            game.ReplicatedStorage.VisualizeMuzzle:FireServer(
                handle,
                true,
                { false, 7, Color3.new(1, 1.1098, 0), 15, true, 0.02 },
                muzzleEffect
            )
        end

        task.spawn(function()
            local startTime = os.clock()
            while os.clock() - startTime < 5 do
                if not SelectedPlayer.Character
                    or not SelectedPlayer.Character:FindFirstChild("Humanoid")
                    or SelectedPlayer.Character.Humanoid.Health <= 0
                then
                    break
                end
                dmg(SelectedPlayer, "Head", 1000)
                task.wait(0.1)
            end
        end)

        WindUI:Notify({ Title = "Kill Player", Content = "Attacking " .. SelectedPlayer.Name, Duration = 2, Icon = "bird" })
    end,
}) 

local spectateToggleEnabled = false  

local spectateToggle = SingleTabSection2:AddToggle({
    Name = "Spectate Player",
    Default = false,
    Callback = function(Value)
        if Value == spectateToggleEnabled then
            return  
        end
        spectateToggleEnabled = Value 
        if Value then
            -- run your actual logic
            if SelectedPlayer and SelectedPlayer.Character and SelectedPlayer.Character:FindFirstChild("Humanoid") then
                workspace.CurrentCamera.CameraSubject = SelectedPlayer.Character.Humanoid
                WindUI:Notify({
                    Title = "Spectate",
                    Content = "On: " .. SelectedPlayer.Name,
                    Duration = 2,
                    Icon = "eye"
                })
            else
                WindUI:Notify({
                    Title = "Spectate",
                    Content = "No target selected",
                    Duration = 2,
                    Icon = "alert"
                })
                spectateToggle.Value = false
            end
        else
            -- reset camera
            if LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("Humanoid") then
                workspace.CurrentCamera.CameraSubject = LocalPlayer.Character.Humanoid
            end
            WindUI:Notify({
                Title = "Spectate",
                Content = "Off",
                Duration = 2,
                Icon = "circle-plus"
            })
        end
    end,
})

local killBringActive = false
local bringClone
bringClone = SingleTabSection2:AddToggle({
    Name = "BringClone",
    Default = false,
    Callback = function(Value)
        if Value then
            if not SelectedPlayer then
                WindUI:Notify({ Title = "KB", Content = "No target selected", Duration = 2, Icon = "alert" })
                if bringClone then
                    bringClone:Set(false)
                end
                return
            end
            if not LocalPlayer.Character or not LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then
                WindUI:Notify({ Title = "KB", Content = "Your character not ready", Duration = 2, Icon = "alert" })
                if bringClone then
                    bringClone:Set(false)
                end
                return
            end
        end

        killBringActive = Value
        if killBringActive then
            local targetPlayer = SelectedPlayer
            task.spawn(function()
                while killBringActive do
                    local tCharacter = targetPlayer and targetPlayer.Character
                    local tRoot = tCharacter and tCharacter:FindFirstChild("HumanoidRootPart")
                    local humanoidRootPart = LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart")

                    if not tRoot or not humanoidRootPart then
                        WindUI:Notify({ Title = "KB", Content = "No target/self", Duration = 2, Icon = "alert" })
                        killBringActive = false
                        if bringClone then
                            bringClone:Set(false)
                        end
                        break
                    end

                    local tHumanoid = tCharacter:FindFirstChildOfClass("Humanoid")
                    if tHumanoid then
                        tHumanoid.Sit = false
                    end

                    task.wait()
                    tRoot.CFrame = humanoidRootPart.CFrame + Vector3.new(3, 1, 0)
                    task.wait(0.1)
                end
            end)
        end
    end,
})

local viewInventory
viewInventory = SingleTabSection2:AddToggle({
    Name = "View Inventory",
    Default = false,
    Callback = function(Value)
        if Value then
            if SelectedPlayer and SelectedPlayer:FindFirstChild("Backpack") then
                local items = {}
                for _, i in ipairs(SelectedPlayer.Backpack:GetChildren()) do
                    table.insert(items, i.Name)
                end
                WindUI:Notify({
                    Title = SelectedPlayer.Name .. "'s Inv",
                    Content = (#items > 0 and table.concat(items, ", ") or "Empty"),
                    Duration = 5,
                    Icon = "circle-plus"
                })
            else
                WindUI:Notify({ Title = "Inv", Content = "No target/backpack", Duration = 2, Icon = "alert" })
            end
            if viewInventory then
                viewInventory:Set(false)
            end
        end
    end,
})












-- SETTINGS
getgenv().HitboxEnabled = false
getgenv().HitboxSize = 10
getgenv().HitboxColor = Color3.fromRGB(255,0,0)


-- LEFT SECTION
local SingleTabLeft5Section = SingleTab:DrawSection({
    Name = "Hitboxes",
    Position = 'Left'
});

-- TOGGLE
SingleTabLeft5Section:AddToggle({
    Name = "Enable Hitbox",
    CurrentValue = false,
    Flag = "HitboxToggle",
    Callback = function(Value)
        getgenv().HitboxEnabled = Value
    end
})

-- SLIDER
SingleTabLeft5Section:AddSlider({
    Name = "Hitbox Size",
    Min = 2,
    Max = 30,
    Increment = 1,
    Suffix = "Size",
    CurrentValue = 10,
    Flag = "HitboxSize",
    Callback = function(Value)
        getgenv().HitboxSize = Value
    end
})

-- COLOR PICKER
SingleTabLeft5Section:AddColorPicker({
    Name = "Hitbox Color",
    Color = Color3.fromRGB(255, 0, 0),
    Flag = "HitboxColor",
    Callback = function(Value)
        getgenv().HitboxColor = Value
    end
})

-- LOOP
RunService.RenderStepped:Connect(function()

    if getgenv().HitboxEnabled then

        for _, player in pairs(Players:GetPlayers()) do

            if player ~= LocalPlayer and player.Character then

                local hrp = player.Character:FindFirstChild("HumanoidRootPart")

                if hrp then
                    hrp.Size = Vector3.new(
                        getgenv().HitboxSize,
                        getgenv().HitboxSize,
                        getgenv().HitboxSize
                    )

                    hrp.Transparency = 0.5
                    hrp.BrickColor = BrickColor.new(getgenv().HitboxColor)
                    hrp.Material = Enum.Material.Neon
                    hrp.CanCollide = false
                end
            end
        end

    else

        -- RESET
        for _, player in pairs(Players:GetPlayers()) do

            if player ~= LocalPlayer and player.Character then

                local hrp = player.Character:FindFirstChild("HumanoidRootPart")

                if hrp then
                    hrp.Size = Vector3.new(2,2,1)
                    hrp.Transparency = 1
                    hrp.Material = Enum.Material.Plastic
                end
            end
        end

    end
end)












local CS_ESP_Settings = {
    Enabled = false,
    CornerBoxes = false,
    Chams = false,
    Distance = false,
    Weapons = false,
    HealthBars = false,
    Names = false,
    MaxDistance = 500,
    Accent = Color3.fromRGB(170, 170, 170),
    ChamFill = Color3.fromRGB(35, 35, 35),
}

local CS_ESP_Players = game:GetService("Players")
local CS_ESP_RunService = game:GetService("RunService")
local CS_ESP_CoreGui = game:GetService("CoreGui")
local CS_ESP_Camera = workspace.CurrentCamera
local CS_ESP_LocalPlayer = CS_ESP_Players.LocalPlayer

local CS_ESP_Gui = Instance.new("ScreenGui")
CS_ESP_Gui.Name = "Scorpio_VisualsESP"
CS_ESP_Gui.IgnoreGuiInset = true
CS_ESP_Gui.ResetOnSpawn = false
CS_ESP_Gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
CS_ESP_Gui.Parent = CS_ESP_CoreGui

local CS_ESP_Objects = {}

local function CS_ESP_NewLine(parent)
    local f = Instance.new("Frame")
    f.BackgroundColor3 = CS_ESP_Settings.Accent
    f.BorderSizePixel = 0
    f.Visible = false
    f.Parent = parent
    return f
end

local function CS_ESP_NewText(parent)
    local t = Instance.new("TextLabel")
    t.BackgroundTransparency = 1
    t.TextColor3 = Color3.fromRGB(230, 230, 230)
    t.TextStrokeTransparency = 0.35
    t.Font = Enum.Font.GothamMedium
    t.TextSize = 12
    t.Visible = false
    t.Parent = parent
    return t
end

local function CS_ESP_Create(plr)
    if plr == CS_ESP_LocalPlayer or CS_ESP_Objects[plr] then return end

    local holder = Instance.new("Folder")
    holder.Name = "ESP_" .. plr.Name
    holder.Parent = CS_ESP_Gui

    local box = {}
    for i = 1, 8 do
        box[i] = CS_ESP_NewLine(holder)
    end

    local distance = CS_ESP_NewText(holder)
    local weapon = CS_ESP_NewText(holder)
    local name = CS_ESP_NewText(holder)
    local healthBack = Instance.new("Frame")
    healthBack.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
    healthBack.BorderSizePixel = 0
    healthBack.Visible = false
    healthBack.Parent = holder

    local healthFill = Instance.new("Frame")
    healthFill.BackgroundColor3 = Color3.fromRGB(170, 170, 170)
    healthFill.BorderSizePixel = 0
    healthFill.Parent = healthBack

    local highlight = Instance.new("Highlight")
    highlight.Name = "CompServices_Chams"
    highlight.FillColor = CS_ESP_Settings.ChamFill
    highlight.OutlineColor = CS_ESP_Settings.Accent
    highlight.FillTransparency = 0.55
    highlight.OutlineTransparency = 0
    highlight.Enabled = false
    highlight.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
    highlight.Parent = CS_ESP_CoreGui

    CS_ESP_Objects[plr] = {
        Holder = holder,
        Box = box,
        Distance = distance,
        Weapon = weapon,
        Name = name,
        HealthBack = healthBack,
        HealthFill = healthFill,
        Highlight = highlight,
    }
end

local function CS_ESP_Remove(plr)
    local obj = CS_ESP_Objects[plr]
    if not obj then return end
    pcall(function() obj.Holder:Destroy() end)
    pcall(function() obj.Highlight:Destroy() end)
    CS_ESP_Objects[plr] = nil
end

local function CS_ESP_SetBox(box, x, y, w, h)
    local thick = 2
    local len = math.clamp(math.floor(w * 0.25), 8, 28)

    box[1].Position = UDim2.fromOffset(x, y)
    box[1].Size = UDim2.fromOffset(len, thick)
    box[2].Position = UDim2.fromOffset(x, y)
    box[2].Size = UDim2.fromOffset(thick, len)

    box[3].Position = UDim2.fromOffset(x + w - len, y)
    box[3].Size = UDim2.fromOffset(len, thick)
    box[4].Position = UDim2.fromOffset(x + w - thick, y)
    box[4].Size = UDim2.fromOffset(thick, len)

    box[5].Position = UDim2.fromOffset(x, y + h - thick)
    box[5].Size = UDim2.fromOffset(len, thick)
    box[6].Position = UDim2.fromOffset(x, y + h - len)
    box[6].Size = UDim2.fromOffset(thick, len)

    box[7].Position = UDim2.fromOffset(x + w - len, y + h - thick)
    box[7].Size = UDim2.fromOffset(len, thick)
    box[8].Position = UDim2.fromOffset(x + w - thick, y + h - len)
    box[8].Size = UDim2.fromOffset(thick, len)
end

local function CS_ESP_GetWeapon(char, plr)
    local tool = char and char:FindFirstChildOfClass("Tool")
    if tool then return tool.Name end
    local bp = plr:FindFirstChildOfClass("Backpack")
    if bp then
        local backpackTool = bp:FindFirstChildOfClass("Tool")
        if backpackTool then
            return backpackTool.Name
        end
    end
    return "None"
end

local function CS_ESP_Hide(obj)
    if not obj then return end
    for _, v in ipairs(obj.Box) do v.Visible = false end
    obj.Distance.Visible = false
    obj.Weapon.Visible = false
    obj.Name.Visible = false 
    obj.HealthBack.Visible = false
    obj.Highlight.Enabled = false
end

for _, plr in ipairs(CS_ESP_Players:GetPlayers()) do
    CS_ESP_Create(plr)
end

CS_ESP_Players.PlayerAdded:Connect(CS_ESP_Create)
CS_ESP_Players.PlayerRemoving:Connect(CS_ESP_Remove)

CS_ESP_RunService.RenderStepped:Connect(function()
    CS_ESP_Camera = workspace.CurrentCamera

    for _, plr in ipairs(CS_ESP_Players:GetPlayers()) do
        if plr ~= CS_ESP_LocalPlayer then
            CS_ESP_Create(plr)
            local obj = CS_ESP_Objects[plr]
            local char = plr.Character
            local root = char and char:FindFirstChild("HumanoidRootPart")
            local hum = char and char:FindFirstChildOfClass("Humanoid")

            if not CS_ESP_Settings.Enabled or not char or not root or not hum or hum.Health <= 0 then
                CS_ESP_Hide(obj)
                continue
            end

            local dist = (CS_ESP_Camera.CFrame.Position - root.Position).Magnitude
            if dist > CS_ESP_Settings.MaxDistance then
                CS_ESP_Hide(obj)
                continue
            end

            local rootPos, onScreen = CS_ESP_Camera:WorldToViewportPoint(root.Position)
            if not onScreen then
                CS_ESP_Hide(obj)
                continue
            end

            local scale = math.clamp(1 / (rootPos.Z * math.tan(math.rad(CS_ESP_Camera.FieldOfView / 2)) * 2) * 1000, 0, 1000)
            local width = math.floor(4 * scale)
            local height = math.floor(6 * scale)
            local x = math.floor(rootPos.X - width / 2)
            local y = math.floor(rootPos.Y - height / 2)

            for _, line in ipairs(obj.Box) do
                line.BackgroundColor3 = CS_ESP_Settings.Accent
                line.Visible = CS_ESP_Settings.CornerBoxes
            end
            if CS_ESP_Settings.CornerBoxes then
                CS_ESP_SetBox(obj.Box, x, y, width, height)
            end

            obj.Highlight.Adornee = char
            obj.Highlight.FillColor = CS_ESP_Settings.ChamFill
            obj.Highlight.OutlineColor = CS_ESP_Settings.Accent
            obj.Highlight.Enabled = CS_ESP_Settings.Chams

            obj.Distance.Text = tostring(math.floor(dist)) .. " studs"
            obj.Distance.Position = UDim2.fromOffset(x + width / 2 - 55, y + height + 2)
            obj.Distance.Size = UDim2.fromOffset(110, 16)
            obj.Distance.Visible = CS_ESP_Settings.Distance

            obj.Weapon.Text = CS_ESP_GetWeapon(char, plr)
            obj.Weapon.Position = UDim2.fromOffset(x + width / 2 - 75, y - 18)
            obj.Weapon.Size = UDim2.fromOffset(150, 16)
            obj.Weapon.Visible = CS_ESP_Settings.Weapons

           obj.Name.Text = plr.Name
obj.Name.Position = UDim2.fromOffset(x + width / 2 - 75, y - 32)
obj.Name.Size = UDim2.fromOffset(150, 16)
obj.Name.Visible = CS_ESP_Settings.Names  
            obj.HealthBack.Position = UDim2.fromOffset(x - 7, y)
            obj.HealthBack.Size = UDim2.fromOffset(4, height)
            obj.HealthBack.Visible = CS_ESP_Settings.HealthBars

            local hpPercent = math.clamp(hum.Health / math.max(hum.MaxHealth, 1), 0, 1)
            obj.HealthFill.Position = UDim2.fromScale(0, 1 - hpPercent)
            obj.HealthFill.Size = UDim2.fromScale(1, hpPercent)
            obj.HealthFill.BackgroundColor3 = CS_ESP_Settings.Accent
        end
    end
end)

-- LEFT SECTION
local SingleTabLeft6Section = SingleTab:DrawSection({
    Name = "Esp",
    Position = 'Right'
});

SingleTabLeft6Section:AddToggle({
    Name = "Enable ESP",
    Default = false,
    Callback = function(v)
        CS_ESP_Settings.Enabled = v
    end
})

SingleTabLeft6Section:AddToggle({
    Name = "Corner Boxes",
    Default = false,
    Callback = function(v)
        CS_ESP_Settings.CornerBoxes = v
    end
})

SingleTabLeft6Section:AddToggle({
    Name = "Chams",
    Default = false,
    Callback = function(v)
        CS_ESP_Settings.Chams = v
    end
})

SingleTabLeft6Section:AddToggle({
    Name = "Distance",
    Default = false,
    Callback = function(v)
        CS_ESP_Settings.Distance = v
    end
})

SingleTabLeft6Section:AddToggle({
    Name = "Weapon Holdings",
    Default = false,
    Callback = function(v)
        CS_ESP_Settings.Weapons = v
    end
})

SingleTabLeft6Section:AddToggle({
    Name = "Health Bars",
    Default = false,
    Callback = function(v)
        CS_ESP_Settings.HealthBars = v
    end
})

SingleTabLeft6Section:AddToggle({
    Name = "Name ESP",
    Default = false,
    Callback = function(v)
        CS_ESP_Settings.Names = v
    end
})

SingleTabLeft6Section:AddSlider({
    Name = "ESP Max Distance",
    Increment = 10,
    Value = {
        Min = 50,
        Max = 3000,
        Default = CS_ESP_Settings.MaxDistance,
    },
    Callback = function(v)
        CS_ESP_Settings.MaxDistance = v
    end
})

-- Container Tab (EMPTY - NO DUPLICATION)
local ContainerTab = Window:DrawTab({
	Name = "Infinite Cash",
	Icon = "dollar-sign",
});

local Tab2Section = ContainerTab:DrawSection({
    Name = "Max Money",
    Position = 'left'
});

Tab2Section:AddButton({
    Name = "Generate Max Money",
    Callback = function()
        local Found, Cup = GetFruitCup()
        
        if not LocalPlayer.Character or not LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then
            Notifier.new({
                Title = "Error",
                Content = "Character not found!",
                Duration = 3,
                Icon = "rbxassetid://81817688420352"
            })
            return
        end
        
        local OLDCFrame = LocalPlayer.Character.HumanoidRootPart.CFrame
        
        -- If cup already exists, just sell it
        if Cup and Found then
            if Cup.Parent == LocalPlayer.Backpack then
                LocalPlayer.Character.Humanoid:EquipTool(Cup)
                task.wait(1.2)
            end
            
            Teleport(Workspace["IceFruit Sell"].CFrame + Vector3.new(0, 3, 0), true)
            task.wait(0.5)
            
            local prompt = Workspace["IceFruit Sell"]:FindFirstChildOfClass("ProximityPrompt")
            if prompt then
                local originalHoldDuration = prompt.HoldDuration
                local originalMaxDistance = prompt.MaxActivationDistance
                
                prompt.HoldDuration = 0
                prompt.MaxActivationDistance = 50
                prompt.RequiresLineOfSight = false
                
                LocalPlayer.Character.HumanoidRootPart.Anchored = true
                task.wait(0.2)
                
                for i = 1, 100 do
                    fireproximityprompt(prompt, 0)
                    task.wait(0.01)
                end
                
                prompt.HoldDuration = originalHoldDuration
                prompt.MaxActivationDistance = originalMaxDistance
                LocalPlayer.Character.HumanoidRootPart.Anchored = false
            end
            
            task.wait(0.5)
            Teleport(OLDCFrame, true)
            
            Notifier.new({
                Title = "Success",
                Content = "Ice-Fruit Cup sold!",
                Duration = 3,
                Icon = "rbxassetid://81817688420352"
            })
            return
        end
        
        -- Otherwise, craft and sell
        local Itemz = {"FijiWater", "FreshWater", "Ice-Fruit Bag", "Ice-Fruit Cupz"}
        local Stove
        
        for _, Value in ipairs(Workspace.CookingPots:GetChildren()) do
            if Value:IsA("Model") then
                local prompt = Value:FindFirstChildWhichIsA("ProximityPrompt", true)
                if prompt and prompt.ActionText == "Turn On" and prompt.Enabled then
                    Stove = Value
                    break
                end
            end
        end
        
        if not Stove then
            Notifier.new({
                Title = "Error",
                Content = "No available stove found!",
                Duration = 3,
                Icon = "rbxassetid://81817688420352"
            })
            return
        end
        
        for _, Value in ipairs(Itemz) do
            if not LocalPlayer.Backpack:FindFirstChild(Value) then
                ReplicatedStorage:WaitForChild("ExoticShopRemote"):InvokeServer(Value)
                task.wait(1.5)
            end
        end
        
        local Check = false
        for _, Value in ipairs(Itemz) do
            if not LocalPlayer.Backpack:FindFirstChild(Value) then
                Check = true
                break
            end
        end
        
        if Check then
            Notifier.new({
                Title = "Error",
                Content = "Failed to purchase all items!",
                Duration = 3,
                Icon = "rbxassetid://81817688420352"
            })
            return
        end
        
        Teleport(Stove.CookPart.CFrame, true)
        task.wait(1.5)
        
        StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
        LocalPlayer.Character.HumanoidRootPart.Anchored = true
        task.wait(2)
        
        local stovePrompt = Stove:FindFirstChildWhichIsA("ProximityPrompt", true)
        fireproximityprompt(stovePrompt)
        task.wait(2.5)
        
        for _, Value in ipairs({"FijiWater", "FreshWater", "Ice-Fruit Bag"}) do
            local tool = LocalPlayer.Backpack:FindFirstChild(Value)
            if tool then
                LocalPlayer.Character.Humanoid:EquipTool(tool)
                task.wait(1.5)
                fireproximityprompt(stovePrompt)
                task.wait(3.5)
            end
        end
        
        repeat task.wait(0.5) until Stove.CookPart.Steam.LoadUI.Enabled == false
        
        if not LocalPlayer.Character:FindFirstChild("Ice-Fruit Cupz") then
            local cupTool = LocalPlayer.Backpack:FindFirstChild("Ice-Fruit Cupz")
            if cupTool then
                LocalPlayer.Character.Humanoid:EquipTool(cupTool)
                task.wait(1.5)
            end
        end
        
        task.wait(1.5)
        fireproximityprompt(stovePrompt)
        task.wait(3.5)
        
        LocalPlayer.Character.HumanoidRootPart.Anchored = false
        Teleport(Workspace["IceFruit Sell"].CFrame + Vector3.new(0, 3, 0), true)
        task.wait(1.5)
        
        LocalPlayer.Character.HumanoidRootPart.Anchored = true
        task.wait(2)
        
        if not LocalPlayer.Character:FindFirstChild("Ice-Fruit Cupz") then
            local cupTool = LocalPlayer.Backpack:FindFirstChild("Ice-Fruit Cupz")
            if cupTool then
                LocalPlayer.Character.Humanoid:EquipTool(cupTool)
                task.wait(1.5)
            end
        end
        
        local prompt = Workspace["IceFruit Sell"]:FindFirstChildOfClass("ProximityPrompt")
        if prompt then
            local originalHoldDuration = prompt.HoldDuration
            local originalMaxDistance = prompt.MaxActivationDistance
            
            prompt.HoldDuration = 0
            prompt.MaxActivationDistance = 50
            prompt.RequiresLineOfSight = false
            
            for i = 1, 100 do
                fireproximityprompt(prompt, 0)
                task.wait(0.01)
            end
            
            prompt.HoldDuration = originalHoldDuration
            prompt.MaxActivationDistance = originalMaxDistance
        end
        
        LocalPlayer.Character.HumanoidRootPart.Anchored = false
        StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
        
        task.wait(1)
        Teleport(OLDCFrame, true)
        task.wait(2)
        
        Notifier.new({
            Title = "Success",
            Content = "Ice-Fruit Cup crafted and sold!",
            Duration = 5,
            Icon = "rbxassetid://81817688420352"
        })
    end,
})












local Tab2Section1 = ContainerTab:DrawSection({
    Name = "Manual Max Money",
    Position = 'Right'
});

local player = game.Players.LocalPlayer
local humanoidRootPart


player.CharacterAdded:Connect(function(char)
    humanoidRootPart = char:WaitForChild("HumanoidRootPart", 10)
end)

if player.Character then
    humanoidRootPart = player.Character:FindFirstChild("HumanoidRootPart")
end

local function updateCharacterReferences()
    local character = player.Character or player.CharacterAdded:Wait()
    humanoidRootPart = character:WaitForChild("HumanoidRootPart", 5)
end

updateCharacterReferences()

local function teleportToCookingSpot()
    local cookingPos = Vector3.new(-1605.9183349609375, 254.04150390625, -488.43804931640625)

    updateCharacterReferences()

    local humanoid = humanoidRootPart and humanoidRootPart.Parent:FindFirstChild("Humanoid")
    if not humanoid then return end

    getgenv().SwimMethod = true

    humanoid:ChangeState(0)
    repeat task.wait(0.0001) until not player:GetAttribute("LastACPos")

    humanoidRootPart.CFrame = CFrame.new(cookingPos)

    task.wait()
    humanoid:ChangeState(2)

    getgenv().SwimMethod = false

    Rayfield:Notify({
        Title = "Teleported",
        Content = "Teleported to Cookin Spot",
        Duration = 5,
    })
end

local Button = Tab2Section1:AddButton({
    Name = "Cook pot (Teleport To Cook)",
    Callback = function()
        teleportToCookingSpot()
    end,
})

local Button1 = Tab2Section1:AddButton({
    Name = "FijiWater (Buy Item)",
    Callback = function()
        game:GetService("ReplicatedStorage").ExoticShopRemote:InvokeServer("FijiWater")
    end
})

local Button2 = Tab2Section1:AddButton({
    Name = "FreshWater (Buy Item)",
    Callback = function()
        game:GetService("ReplicatedStorage").ExoticShopRemote:InvokeServer("FreshWater")
    end
})

local Button3 = Tab2Section1:AddButton({
    Name = "Ice-Fruit Cupz (Buy Item)",
    Callback = function()
        game:GetService("ReplicatedStorage").ExoticShopRemote:InvokeServer("Ice-Fruit Cupz")
    end
})

local Button4 = Tab2Section1:AddButton({
    Name = "Ice-Fruit Bag (Buy Item)",
    Callback = function()
        game:GetService("ReplicatedStorage").ExoticShopRemote:InvokeServer("Ice-Fruit Bag")
    end
})

-- BUTTON
Tab2Section1:AddButton({
    Name = "TP To Get Infinit Money",

    Callback = function()

        local player = game.Players.LocalPlayer
        local StarterGui = game:GetService("StarterGui")
        local camera = game.Workspace.CurrentCamera
        local humanoidRootPart = player.Character and player.Character:FindFirstChild("HumanoidRootPart")

        local originalCameraType = camera.CameraType
        local originalFieldOfView = camera.FieldOfView
        local originalCameraShake = camera:FindFirstChild("CameraShake")
        local cameraShakeBackup = originalCameraShake and originalCameraShake.Value or nil

        local function GetCharacter()
            return player and player.Character
        end

        getgenv().SwimMethod = false

        local function enableSwimMethod()
            getgenv().SwimMethod = true
            task.wait(1)
        end

        local function disableSwimMethod()
            getgenv().SwimMethod = false
        end

        local function SwimBypassTeleport(destinationCFrame)
            local character = GetCharacter()
            if not character or not character:FindFirstChild("HumanoidRootPart") then return end

            local HRP = character.HumanoidRootPart

            enableSwimMethod()
            task.wait(0.25)

            HRP.CFrame = destinationCFrame + Vector3.new(2, 0, 0)

            task.delay(0.25, function()
                disableSwimMethod()
            end)
        end

        local tool = player.Backpack:FindFirstChild("Ice-Fruit Cupz")
        if tool then
            player.Character.Humanoid:EquipTool(tool)
        else
            Rayfield:Notify({
                Title = "No Ice-Fruit Cupz",
                Content = "Ice-Fruit Cupz' not found in backpack",
                Duration = 5,
            })
            return
        end

        local blackScreen = Instance.new("ScreenGui")
        blackScreen.IgnoreGuiInset = true
        blackScreen.Parent = game:GetService("CoreGui")

        local frame = Instance.new("Frame", blackScreen)
        frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
        frame.Size = UDim2.new(1, 0, 1, 0)
        frame.Position = UDim2.new(0, 0, 0, 0)
        frame.BorderSizePixel = 0
        frame.Visible = true

        local imageLabel = Instance.new("ImageLabel", frame)
        imageLabel.Size = UDim2.new(0.8, 0, 0.8, 0)
        imageLabel.Position = UDim2.new(0.1, 0, 0.1, 0)
        imageLabel.BackgroundTransparency = 1
        imageLabel.Image = "118675319260087"
        imageLabel.ScaleType = Enum.ScaleType.Fit

        if not player or not player.Character or not player.Character:FindFirstChild("HumanoidRootPart") then return end
        local originalCFrame = player.Character.HumanoidRootPart.CFrame

        task.wait(0.5)

        local targetCFrame = CFrame.new(-69.82200622558594, 287.0635986328125, -319.79437255859375)
        SwimBypassTeleport(targetCFrame)

        task.wait(0.5)

        local cameraOffset = Vector3.new(0, 5, 5)
        local angleOffset = Vector3.new(0, -1, 0)

        camera.CameraType = Enum.CameraType.Scriptable

        getgenv().cameraFollowConnection = game:GetService("RunService").Heartbeat:Connect(function()
            if humanoidRootPart then
                local characterPos = humanoidRootPart.Position
                camera.CFrame = CFrame.new(characterPos + cameraOffset + angleOffset, characterPos + Vector3.new(0, 3, 0))
            end
        end)

        getgenv().instantPrompts = true

        local iceFruitSellPrompt = workspace:WaitForChild("IceFruit Sell"):WaitForChild("ProximityPrompt")
        if iceFruitSellPrompt then
            iceFruitSellPrompt.HoldDuration = 0
            iceFruitSellPrompt.MaxActivationDistance = 6

            getgenv().updateConnection = game:GetService("RunService").Heartbeat:Connect(function()
                if getgenv().instantPrompts and iceFruitSellPrompt.Enabled then
                    for _ = 1, 300 do
                        iceFruitSellPrompt:InputHoldBegin()
                        iceFruitSellPrompt:InputHoldEnd()
                    end
                end
            end)
        end

        task.spawn(function()
            task.wait(1)

            getgenv().instantPrompts = false

            if getgenv().updateConnection then
                getgenv().updateConnection:Disconnect()
                getgenv().updateConnection = nil
            end

            if iceFruitSellPrompt then
                iceFruitSellPrompt.HoldDuration = 1
                iceFruitSellPrompt.MaxActivationDistance = 4
            end

            enableSwimMethod()
            task.wait(0.5)
            SwimBypassTeleport(originalCFrame)
            task.wait(0.5)
            disableSwimMethod()

            if getgenv().cameraFollowConnection then
                getgenv().cameraFollowConnection:Disconnect()
                getgenv().cameraFollowConnection = nil
            end

            camera.CameraType = originalCameraType
            camera.FieldOfView = originalFieldOfView

            if originalCameraShake then
                originalCameraShake.Value = cameraShakeBackup
            end

            blackScreen:Destroy()

            Rayfield:Notify({
                Title = "Money vulnerability",
                Content = "Done Generating money",
                Duration = 5,
            })
        end)
    end
})












local function Teleport(targetCFrame)
    local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
    local humanoid  = character:FindFirstChild("Humanoid")
    local root      = character:FindFirstChild("HumanoidRootPart")
    if not humanoid or not root then return end

    getgenv().SwimMethod = true
    humanoid:ChangeState(0)

    local n = 0
    repeat task.wait(); n += 1 until n >= 40 and not LocalPlayer:GetAttribute("LastACPos")

    root.CFrame = targetCFrame
    task.wait()
    humanoid:ChangeState(2)
    getgenv().SwimMethod = false
end

-- Find money Machine
local function GetGoodCleaner()
    if not Workspace:FindFirstChild("1# Map") then return nil end
    local CounterInstance
    for _, v in pairs(Workspace["1# Map"]:GetChildren()) do
        if v:FindFirstChild("CounterM") then CounterInstance = v; break end
    end
    if not CounterInstance then return nil end
    for _, v in pairs(CounterInstance:GetChildren()) do
        local cashPrompt = v:FindFirstChild("CashPrompt", true)
        local grabPrompt = v:FindFirstChild("GrabPrompt", true)
        if cashPrompt and cashPrompt.Enabled
            and cashPrompt.ObjectText == "Count Bread"
            and grabPrompt and not grabPrompt.Enabled then
            return v
        end
    end
    return nil
end

local Tab27Section1 = ContainerTab:DrawSection({
    Name = "Clean Money",
    Position = 'Left'
});

Tab27Section1:AddButton({
    Name = "Clean All Dirty Money",
    Callback = function()
        local stored = LocalPlayer:FindFirstChild("stored")
        if not stored or not stored:FindFirstChild("FilthyStack") or stored.FilthyStack.Value == 0 then
            Rayfield:Notify({ Title = "LuhjayFamily | Error!", Content = "You don't have any filthy cash!", Duration = 5, Image = 97118059177470 })
            return
        end
        if not LocalPlayer.Character or not LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then return end
        local hum = LocalPlayer.Character:FindFirstChild("Humanoid")
        if not hum or hum.Health == 0 then return end

        local Cleaner = GetGoodCleaner()
        if not Cleaner then
            Rayfield:Notify({ Title = "LuhjayFamily | Error!", Content = "Couldn't find a good cleaner!", Duration = 5, Image = 97118059177470 })
            return
        end

        Teleport(Cleaner:GetPivot()); task.wait(0.4)
        fireproximityprompt(Cleaner:FindFirstChild("CashPrompt", true))
        repeat task.wait() until Cleaner:FindFirstChild("On", true) and Cleaner:FindFirstChild("On", true).Color == Color3.fromRGB(74, 156, 69)
        task.wait(0.5)
        fireproximityprompt(Cleaner:FindFirstChild("CashPrompt", true)); task.wait(0.25)
        Teleport(Cleaner:GetPivot()); task.wait(0.4)
        repeat task.wait() until LocalPlayer.Backpack:FindFirstChild("MoneyReady")
        LocalPlayer.Character.Humanoid:EquipTool(LocalPlayer.Backpack["MoneyReady"])
        repeat task.wait(1) fireproximityprompt(Cleaner:FindFirstChild("GrabPrompt", true)) until not LocalPlayer.Character:FindFirstChild("MoneyReady")
        repeat task.wait() until LocalPlayer.Backpack:FindFirstChild("BagOfMoney")
        Teleport(CFrame.new(-1215.96, 253.88, -3636.11)); task.wait(0.4)
        LocalPlayer.Character.Humanoid:EquipTool(LocalPlayer.Backpack["BagOfMoney"]); task.wait(1)
        fireproximityprompt(Workspace.ATMMoney.Prompt)
        Rayfield:Notify({ Title = "LuhjayFamily | Success!", Content = "Filthy money cleaned!", Duration = 4, Image = 4483362458 })
    end,
})

local ShopTab = Window:DrawTab({
	Icon = "shopping-cart",
	Name = "Shop",
	Type = "Single",
	EnableScrolling = true
});

local Shopon = ShopTab:DrawSection({
    Name = "Purchase More Items",
    Position = 'Left'
});

local toggledGUIs = {}
	local shopGUIs = {
		["Bronx Market"] = "Bronx Market 2",
		["Tattoo Shop"] = "Bronx TATTOOS",
		["Open Trunk"] = "TRUNK STORAGE",
		["BRONX PAWNING"] = "Bronx PAWNING",
		["BRONX CLOTHING"] = "Bronx CLOTHING",
		["Gas Station"] = "ShopGUI",
		["EXOTIC DEALER"] = "ThaShop"
	}

	local function getKeys(tbl)
		local keys = {}
		for k, _ in pairs(tbl) do
			table.insert(keys, k)
		end
		return keys
	end

	local shopList = getKeys(shopGUIs)
	local currentSelection = nil 

	Shopon:AddDropdown({
		Name = "Select Shop",
		Values = shopList,
		Callback = function(option)
			currentSelection = option 
		end
	})

	Shopon:AddButton({
		Name = "Open/Close Selected Shop",
		Callback = function()
			if not currentSelection then
				return
			end
			local guiName = shopGUIs[currentSelection]
			if not guiName then
				return
			end
			local gui = game.Players.LocalPlayer.PlayerGui:FindFirstChild(guiName)
			if not gui then
				return
			end
			pcall(function()
				gui.Enabled = not gui.Enabled
				Notifier.new({
					Title = "Shop GUI",
					Content = (gui.Enabled and "Opened" or "Closed") .. " " .. currentSelection,
					Duration = 2,
					Icon = "rbxassetid://102986210668448"
				})
			end)
		end
	})

	local quickBuyItems = {
		"Lemonade - $500",
		"Screw - $2000", 
		"Bandage - $350",
		"FakeCard - $700",
		"Ice-Fruit Bag - $2500",
		"Ice-Fruit Cupz - $150",
		"FijiWater - $48",
		"FreshWater - $48",
		".Extended",
		".9mm",
		"7.62",
		"5.56",
		".10mm",
		"Draco - $6000",
		"ARPistol - $6000",
		"HPBrowning Ext - $6000",
		"Glock17 - $4500",
		"Glock22 - $4500",
		"Seeds - $4500",
		"SugarBag - $3300",
		"FijiWater - $300"
	}

	local selectedQuickBuyItem = "Lemonade - $500"

	Shopon:AddDropdown({
		Name = "Select Item to Buy",
		Values = quickBuyItems,
		Callback = function(option)
			selectedQuickBuyItem = option
		end
	})

	Shopon:AddButton({
		Name = "Buy Selected Item",
		Callback = function()
			local pick = selectedQuickBuyItem
			local ReplicatedStorage = game:GetService("ReplicatedStorage")
			
			if pick == "Lemonade - $500" then
				ReplicatedStorage:WaitForChild("ExoticShopRemote"):InvokeServer("Lemonade")
			elseif pick == "Screw - $2000" then
				ReplicatedStorage:WaitForChild("ExoticShopRemote"):InvokeServer("Screw")
			elseif pick == "Bandage - $350" then
				ReplicatedStorage:WaitForChild("ExoticShopRemote"):InvokeServer("Bandage")
			elseif pick == "FakeCard - $700" then
				ReplicatedStorage:WaitForChild("ExoticShopRemote"):InvokeServer("FakeCard")
			elseif pick == "Ice-Fruit Bag - $2500" then
				ReplicatedStorage:WaitForChild("ExoticShopRemote"):InvokeServer("Ice-Fruit Bag")
			elseif pick == "Ice-Fruit Cupz - $150" then
				ReplicatedStorage:WaitForChild("ExoticShopRemote"):InvokeServer("Ice-Fruit Cupz")
			elseif pick == "FijiWater - $48" then
				ReplicatedStorage:WaitForChild("ExoticShopRemote"):InvokeServer("FijiWater")
			elseif pick == "FreshWater - $48" then
				ReplicatedStorage:WaitForChild("ExoticShopRemote"):InvokeServer("FreshWater")
			elseif pick == ".Extended" then
				ReplicatedStorage:WaitForChild("ExoticShopRemote"):InvokeServer(pick)
			elseif pick == ".9mm" then
				ReplicatedStorage:WaitForChild("ExoticShopRemote"):InvokeServer(pick)
			elseif pick == "7.62" then
				ReplicatedStorage:WaitForChild("ExoticShopRemote"):InvokeServer(pick)
			elseif pick == "5.56" then
				ReplicatedStorage:WaitForChild("ExoticShopRemote"):InvokeServer(pick)
			elseif pick == ".10mm" then
				ReplicatedStorage:WaitForChild("ExoticShopRemote"):InvokeServer(pick)
			end

			if pick == "Draco - $6000" then
				game:GetService("ReplicatedStorage"):WaitForChild("ShopRemote5"):InvokeServer("Draco")
			elseif pick == "ARPistol - $6000" then
				game:GetService("ReplicatedStorage"):WaitForChild("ShopRemote5"):InvokeServer("ARPistol")
			elseif pick == "HPBrowning Ext - $6000" then
				game:GetService("ReplicatedStorage"):WaitForChild("ShopRemote5"):InvokeServer("HPBrowning Ext")
			elseif pick == "Glock17 - $4500" then
				game:GetService("ReplicatedStorage"):WaitForChild("ShopRemote5"):InvokeServer("Glock17")
			elseif pick == "Glock22 - $4500" then
				game:GetService("ReplicatedStorage"):WaitForChild("ShopRemote5"):InvokeServer("Glock22")
			end

			if pick == "Seeds - $4500" then
				game:GetService("ReplicatedStorage"):WaitForChild("ShopRemote6"):InvokeServer("Seeds")
			elseif pick == "SugarBag - $3300" then
				game:GetService("ReplicatedStorage"):WaitForChild("ShopRemote6"):InvokeServer("SugarBag")
			elseif pick == "FijiWater - $300" then
				game:GetService("ReplicatedStorage"):WaitForChild("ShopRemote6"):InvokeServer("FijiWater")
			end
			
			Notifier.new({
				Title = "Quick Buy",
				Content = "Attempting to buy: " .. pick,
				Duration = 2,
				Icon = "rbxassetid://102986210668448"
			})
		end
	})












local Shopons = ShopTab:DrawSection({
    Name = "Buy Clothes",
    Position = 'Right'
});

-- FUNCTIONS
local function BuyCloth(category, item)
    if not category or not item then return end
    game:GetService("ReplicatedStorage").ClothShopRemote:FireServer("Buy", category, item)
end

local function WearCloth(category, item)
    if not category or not item then return end
    game:GetService("ReplicatedStorage").ClothShopRemote:FireServer("Wear", category, item)
end

 Shopons:AddButton({
    Name = "Drip Fit",
    Callback = function()

        -- BUY
        BuyCloth("Shirts", "Blu Moncler")
        BuyCloth("Pants", "Amiri Blue Jeans")
        BuyCloth("Shiestys", "Shiesty")

        task.wait(0.3)

        -- WEAR
        WearCloth("Shirts", "Blu Moncler")
        WearCloth("Pants", "Amiri Blue Jeans")
        WearCloth("Shiestys", "Shiesty")

        print("Drip Fit Applied")
    end
})

Shopons:AddButton({
    Name = "Drip Fit",
    Callback = function()

        -- BUY
        BuyCloth("Shirts", "Amiri Star Hoodie")
        BuyCloth("Pants", "Black Amiri Jeans B22")
        BuyCloth("Shiestys", "Shiesty")

        task.wait(0.3)

        -- WEAR
        WearCloth("Shirts", "Amiri Star Hoodie")
        WearCloth("Pants", "Black Amiri Jeans B22")
        WearCloth("Shiestys", "Shiesty")

        print("Drip Fit Applied")
    end
})

Shopons:AddButton({
    Name = "Drip Fit",
    Callback = function()

        -- BUY
        BuyCloth("Shirts", "Red Sp5der Sweats")
        BuyCloth("Pants", "Red Sp5der Sweats")
        BuyCloth("Shiestys", "RedShiesty")

        task.wait(0.3)

        -- WEAR
        WearCloth("Shirts", "Red Sp5der Sweats")
        WearCloth("Pants", "Red Sp5der Sweats")
        WearCloth("Shiestys", "RedShiesty")

        print("Drip Fit Applied")
    end
})

Shopons:AddButton({
    Name = "Drip Fit",
    Callback = function()

        -- BUY
        BuyCloth("Shirts", "Green Sp5der Sweats")
        BuyCloth("Pants", "Green Sp5der Sweats")
        BuyCloth("Shiestys", "Shiesty")

        task.wait(0.3)

        -- WEAR
        WearCloth("Shirts", "Green Sp5der Hoodie")
        WearCloth("Pants", "Green Sp5der Sweats")
        WearCloth("Shiestys", "Shiesty")

        print("Drip Fit Applied")
    end
})

Shopons:AddButton({
    Name = "Drip Fit",
    Callback = function()

        -- BUY
        BuyCloth("Shirts", "Blue Sp5der Hoodie")
        BuyCloth("Pants", "Blue Sp5der Sweats")
        BuyCloth("Shiestys", "Shiesty")

        task.wait(0.3)

        -- WEAR
        WearCloth("Shirts", "Blue Sp5der Hoodie")
        WearCloth("Pants", "Blue Sp5der Sweats")
        WearCloth("Shiestys", "Shiesty")

        print("Drip Fit Applied")
    end
})

Shopons:AddButton({
    Name = "Drip Fit",
    Callback = function()

        -- BUY
        BuyCloth("Shirts", "Red Zipped Jacket")
        BuyCloth("Pants", "White AF1 BJeans")
        

        task.wait(0.3)

        -- WEAR
        WearCloth("Shirts", "Red Zipped Jacket")
        WearCloth("Pants", "White AF1 BJeans")
        

        print("Drip Fit Applied")
    end
})












local Shoponss = ShopTab:DrawSection({
    Name = "Buy Items",
    Position = 'Left'
});

Shoponss:AddButton({
    Name = "Buy Red Camo Gloves",
    Callback = function()
        game:GetService("ReplicatedStorage").ShopRemote:InvokeServer("RedCamoGloves")
    end
})

Shoponss:AddButton({
    Name = "Buy Yello Camo Gloves",
    Callback = function()
        game:GetService("ReplicatedStorage").ShopRemote:InvokeServer("YelloCamoGloves")
    end
})

Shoponss:AddButton({
    Name = "Buy Purple Camo Gloves",
    Callback = function()
        game:GetService("ReplicatedStorage").ShopRemote:InvokeServer("PurpleCamoGloves")
    end
})

Shoponss:AddButton({
    Name = "Buy Extended",
    Callback = function()
         game:GetService("ReplicatedStorage"):WaitForChild("ExoticShopRemote"):InvokeServer(".Extended")
    end
})

Shoponss:AddButton({
    Name = "Buy Drum",
    Callback = function()
        game:GetService("ReplicatedStorage"):WaitForChild("ExoticShopRemote"):InvokeServer(".Drum")
    end
})

Shoponss:AddButton({
    Name = "Buy 5.56",
    Callback = function()
        game:GetService("ReplicatedStorage"):WaitForChild("ExoticShopRemote"):InvokeServer("5.56")
    end
})

Shoponss:AddButton({
    Name = "Buy 7.62",
    Callback = function()
        game:GetService("ReplicatedStorage"):WaitForChild("ExoticShopRemote"):InvokeServer("7.62")
    end
})












local Shoponsss = ShopTab:DrawSection({
    Name = "Shop Gui",
    Position = 'Right'
});

Shoponsss:AddButton({
    Name = "Bronx Clothing",
    Callback = function()
        pcall(function()
            loadstring(game:HttpGet("https://[Log in to view URL]"))()
        end)
    end
})

Shoponsss:AddButton({
    Name = "Pawn Shop",
    Callback = function()
        local gui = game.Players.LocalPlayer.PlayerGui:FindFirstChild("Bronx PAWNING", true)
        if gui then gui.Enabled = true end
    end
})

Shoponsss:AddButton({
    Name = "Bronx Market",
    Callback = function()
        local gui = game.Players.LocalPlayer:WaitForChild("PlayerGui"):FindFirstChild("Bronx Market 2")
        if gui then gui.Enabled = true end
    end
})

Shoponsss:AddButton({
    Name = "Bronx shop",
    Callback = function()
        task.spawn(function()
            repeat task.wait() until game:IsLoaded()
            repeat task.wait() until game.Players.LocalPlayer
 
            local playerGui = game.Players.LocalPlayer:FindFirstChild("PlayerGui")
            if not playerGui then return end
 
            local shopGui = playerGui:FindFirstChild("ShopGUI", true)
            if shopGui then
                shopGui.Enabled = true
            end
        end)
    end
})

Shoponsss:AddButton({
    Name = "Tha Shop",
    Callback = function()
        task.spawn(function()
            repeat task.wait() until game:IsLoaded()
            repeat task.wait() until game.Players.LocalPlayer
 
            local playerGui = game.Players.LocalPlayer:FindFirstChild("PlayerGui")
            if not playerGui then return end
 
            local thaShopGui = playerGui:FindFirstChild("ThaShop", true)
            if thaShopGui then
                thaShopGui.Enabled = true
            end
        end)
    end
})

local SoTab = Window:DrawTab({
	Icon = "rocket",
	Name = "Misc",
	Type = "Single",
	EnableScrolling = true
});

local Soton = SoTab:DrawSection({
    Name = "Features",
    Position = 'Left'
});

local tagEnabled = true
local rainbowEnabled = true

-- ====================== TAG FUNCTIONS ======================
local function removeTag(character)
    if character then
        local head = character:FindFirstChild("Head")
        if head then
            local tag = head:FindFirstChild("DiscordTag")
            if tag then tag:Destroy() end
        end
    end
end

local function addTag(character)
    if not tagEnabled then return end
    removeTag(character)
    
    local head = character:WaitForChild("Head")
    local billboard = Instance.new("BillboardGui")
    billboard.Name = "DiscordTag"
    billboard.Adornee = head
    billboard.Size = UDim2.new(0, 125, 0, 50)
    billboard.StudsOffset = Vector3.new(0, 3, 0)
    billboard.AlwaysOnTop = true
    billboard.Parent = head

    local text = Instance.new("TextLabel")
    text.Size = UDim2.new(1, 0, 1, 0)
    text.BackgroundTransparency = 1
    text.Text = "discord/ScorpioHub"
    text.TextStrokeTransparency = 0
    text.TextScaled = true
    text.Font = Enum.Font.GothamBold
    text.Parent = billboard

    -- Rainbow Effect (only if enabled)
    if rainbowEnabled then
        task.spawn(function()
            local hue = 0
            while billboard.Parent and tagEnabled and rainbowEnabled do
                hue = (hue + 0.015) % 1
                text.TextColor3 = Color3.fromHSV(hue, 1, 1)
                task.wait(0.05)
            end
            -- If rainbow is turned off while tag is still on
            if billboard.Parent and tagEnabled then
                text.TextColor3 = Color3.fromRGB(255, 0, 0) -- Default white
            end
        end)
    else
        text.TextColor3 = Color3.fromRGB(255, 0, 0) -- White when rainbow is off
    end
end

-- ====================== TOGGLES ======================
Soton:AddToggle({
    Name = "Enable Discord Tag",
    Default = true,
    Callback = function(Value)
        tagEnabled = Value
        if Value then
            if player.Character then
                addTag(player.Character)
            end
            WindUI:Notify({Title = "Discord Tag", Content = "Tag Enabled", Duration = 3})
        else
            if player.Character then
                removeTag(player.Character)
            end
            WindUI:Notify({Title = "Discord Tag", Content = "Tag Disabled", Duration = 3})
        end
    end
})

Soton:AddToggle({
    Name = "Rainbow Tag Color",
    Default = true,
    Callback = function(Value)
        rainbowEnabled = Value
        
        if player.Character and tagEnabled then
            -- Refresh tag to apply new rainbow setting
            removeTag(player.Character)
            task.wait(0.1)
            addTag(player.Character)
        end
        
        WindUI:Notify({
            Title = "Rainbow Tag",
            Content = rainbowEnabled and "Rainbow Enabled" or "Rainbow Disabled (White)",
            Duration = 3
        })
    end
})

-- ====================== CHARACTER HANDLING ======================
local Players = game:GetService("Players")
local player = Players.LocalPlayer

if player.Character then
    addTag(player.Character)
end

player.CharacterAdded:Connect(function(char)
    task.wait(0.5) -- Small delay to ensure Head exists
    addTag(char)
end)

player.CharacterRemoving:Connect(removeTag)

print("Discord Tab loaded with separate Rainbow toggle!")

Soton:AddButton({
    Name = "Drop Item",
    Callback = function()
        local tool = LocalPlayer.Character:FindFirstChildOfClass("Tool")
        if tool then
            ReplicatedStorage.DropItemRemote:FireServer(tool)
            WindUI:Notify({Title = "Drop Item", Content = "Dropped " .. tool.Name, Duration = 2})
        else
            WindUI:Notify({Title = "Drop Item", Content = "No tool equipped!", Duration = 2, Icon = "x"})
        end
    end
})

Soton:AddToggle({
    Name = "Auto Pass",
    Callback = function()
        ReplicatedStorage.DropRemote:FireServer("Drop")
        WindUI:Notify({Title = "Pass Item", Content = "Item passed to nearest player", Duration = 2})
    end
})

Soton:AddToggle({
    Name = "Auto Drop ($5K)",
    Default = false,
    Callback = function(value)
        autoDropEnabled = value
        if value then
            spawn(function()
                while autoDropEnabled do
                    game:GetService("ReplicatedStorage"):WaitForChild("BankProcessRemote"):InvokeServer("Drop", 5000)

                    local giveMoney = game:GetService("ReplicatedStorage"):FindFirstChild("GiveMoney")
                    if giveMoney then
                        giveMoney:FireServer("drop", 5000)
                    end

                    task.wait(0.5)
                end
            end)
        end
    end,
})

-- ==================== SKYBOX SYSTEM ====================
local lightingService = game:GetService("Lighting")
local currentSkybox = nil
local selectedSkyboxName = nil 

local function applySkybox(skyboxId, skyboxName)
    -- Remove existing sky
    for _, v in pairs(lightingService:GetChildren()) do
        if v:IsA("Sky") then
            v:Destroy()
        end
    end

    if not skyboxId or skyboxId == "Undo Skybox" then
        local defaultSkyId = "rbxassetid://81817688420352"
        local sky = Instance.new("Sky")
        sky.SkyboxBk = defaultSkyId
        sky.SkyboxDn = defaultSkyId
        sky.SkyboxFt = defaultSkyId
        sky.SkyboxLf = defaultSkyId
        sky.SkyboxRt = defaultSkyId
        sky.SkyboxUp = defaultSkyId
        sky.Parent = lightingService

        WindUI:Notify({
            Title = "Skybox",
            Content = "Reset to default Roblox sky.",
            Duration = 5
        })
        return
    end

    local sky = Instance.new("Sky")
    sky.SkyboxBk = skyboxId
    sky.SkyboxDn = skyboxId
    sky.SkyboxFt = skyboxId
    sky.SkyboxLf = skyboxId
    sky.SkyboxRt = skyboxId
    sky.SkyboxUp = skyboxId
    sky.Parent = lightingService

    WindUI:Notify({
        Title = "Skybox Enabled",
        Content = (skyboxName or "Custom") .. " skybox activated.",
        Duration = 5
    })
end

local skyboxes = {
    ["ScorpioHub"] = "rbxassetid://81817688420352",
    ["Rick&Morty"] = "rbxassetid://89278222652861",
    ["Old Scorpio"] = "rbxassetid://71724036766193",
    ["Simpsons"] = "rbxassetid://71597428687411",
    ["SpongeBob"] = "rbxassetid://120213323865819",
    ["Galaxy"] = "rbxassetid://75761154013379",
    ["Night Sky"] = "rbxassetid://1012890",
}

local skyboxNames = {}
for name, _ in pairs(skyboxes) do
    table.insert(skyboxNames, name)
end

-- Dropdown
Soton:AddDropdown({
    Name = "Select Skybox",
    Values = skyboxNames,
    Callback = function(selected)
        selectedSkyboxName = selected
    end
})

-- Toggle Button
Soton:AddButton({
    Name = "Enable / Disable Skybox",
    Callback = function()
        if not selectedSkyboxName or selectedSkyboxName == "" then
            WindUI:Notify({
                Title = "Skybox",
                Content = "Please select a skybox first!",
                Duration = 4
            })
            return
        end

        local assetId = skyboxes[selectedSkyboxName]

        if currentSkybox == assetId then
            -- Disable
            applySkybox("Undo Skybox")
            currentSkybox = nil
        else
            -- Enable
            applySkybox(assetId, selectedSkyboxName)
            currentSkybox = assetId
        end
    end
})

-- Extra Button: Reset Skybox
Soton:AddButton({
    Name = "Reset to Default Sky",
    Callback = function()
        applySkybox("Undo Skybox")
        currentSkybox = nil
        selectedSkyboxName = nil
    end
})

print("Skybox Tab Loaded Successfully!")

-- Put this at the top of your script (before your UI)
local currentTrack = nil
local Players = game:GetService("Players")
local player = Players.LocalPlayer

local function StopEmote()
    if currentTrack then
        currentTrack:Stop()
        currentTrack = nil
    end
end

local function PlayEmote(animId, emoteName)
    StopEmote() -- Stop any previous emote first
    
    local character = player.Character
    if not character then 
        warn("Character not loaded for emote: " .. (emoteName or "Unknown"))
        return 
    end
    
    local humanoid = character:FindFirstChildOfClass("Humanoid")
    if not humanoid then 
        warn("No Humanoid found for emote: " .. (emoteName or "Unknown"))
        return 
    end
    
    local animation = Instance.new("Animation")
    animation.AnimationId = "rbxassetid://" .. animId
    
    currentTrack = humanoid:LoadAnimation(animation)
    currentTrack:Play()
    
    -- Auto-stop when animation ends (optional but good)
    currentTrack.Stopped:Connect(function()
        currentTrack = nil
    end)
end

-- Your UI toggles (updated)
Soton:AddToggle({ Name = "Druski Pop Out", Default = false, Callback = function(s)
    if s then PlayEmote("111060112236071", "Druski Pop Out")
    else StopEmote() end
end })

Soton:AddToggle({ Name = "Dougie Meme Dance", Default = false, Callback = function(s)
    if s then PlayEmote("87574738912971", "Dougie Meme Dance")
    else StopEmote() end
end })

Soton:AddToggle({ Name = "Get Sturdy Dance", Default = false, Callback = function(s)
    if s then PlayEmote("102571052202995", "Get Sturdy Dance")
    else StopEmote() end
end })

Soton:AddToggle({ Name = "Shuffle Dance", Default = false, Callback = function(s)
    if s then PlayEmote("136292253730425", "Shuffle Dance")
    else StopEmote() end
end })

Soton:AddToggle({ Name = "Just Vibing Dance", Default = false, Callback = function(s)
    if s then PlayEmote("80621140833482", "Just Vibing Dance")
    else StopEmote() end
end })

Soton:AddToggle({ Name = "Tylil", Default = false, Callback = function(s)
    if s then PlayEmote("93280662293731", "Tylil")
    else StopEmote() end
end })

Soton:AddToggle({ Name = "Rollie", Default = false, Callback = function(s)
    if s then PlayEmote("71586856568221", "Rollie")
    else StopEmote() end
end })

Soton:AddToggle({ Name = "Teach me", Default = false, Callback = function(s)
    if s then PlayEmote("90124908409990", "Teach me")
    else StopEmote() end
end })

Soton:AddToggle({ Name = "Sturdy2", Default = false, Callback = function(s)
    if s then PlayEmote("77925609894489", "Sturdy2")
    else StopEmote() end
end })

Soton:AddToggle({ Name = "Sturdy3", Default = false, Callback = function(s)
    if s then PlayEmote("135055410162594", "Sturdy3")
    else StopEmote() end
end })

Soton:AddToggle({ Name = "TRIP OUT", Default = false, Callback = function(s)
    if s then PlayEmote("135562069901689", "TRIP OUT")
    else StopEmote() end
end })

Soton:AddButton({
    Name = "Stop Current Emote",
    Callback = StopEmote
})

local FarmTab = Window:DrawTab({
	Icon = "wallet",
	Name = "AutoFarm",
	Type = "Single",
	EnableScrolling = true
});

local AutoFarm = FarmTab:DrawSection({
    Name = "AutoFarm",
    Position = 'Left'
});

local player = game.Players.LocalPlayer
	local originalPosition = nil

	local function teleport(x, y, z)
		local char = player.Character or player.CharacterAdded:Wait()
		local humanoid = char:WaitForChild("Humanoid")
		local root = char:WaitForChild("HumanoidRootPart")

		humanoid:ChangeState(0)
		repeat task.wait() until not player:GetAttribute("LastACPos")
		root.CFrame = CFrame.new(x, y, z)
	end

	task.spawn(function()
		while task.wait() do
			if getgenv().SwimMethod then
				local p = game:GetService("Players").LocalPlayer
				if p and p.Character and p.Character:FindFirstChild("Humanoid") then
					p.Character.Humanoid:ChangeState(Enum.HumanoidStateType.FallingDown)
				end
			end
		end
	end)

	AutoFarm:AddToggle({
		Name = "🗑️ Search Trashbags",
		Default = false,
		Callback = function(Value)
			getgenv().loottrash = Value
			getgenv().SwimMethod = Value 

			if Value then
				local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
				if hrp then
					originalPosition = hrp.Position
				end

				task.spawn(function()
					while getgenv().loottrash do
						pcall(function()
							local gui = player:WaitForChild("PlayerGui")
							local pawnGui = gui:FindFirstChild("Bronx PAWNING")
							if pawnGui then
								local list = pawnGui.Frame:FindFirstChild("Holder") and pawnGui.Frame.Holder:FindFirstChild("List")
								if list then
									for _, frame in ipairs(list:GetChildren()) do
										if frame:IsA("Frame") and frame:FindFirstChild("Item") then
											local itemName = frame.Item.Text
											while player.Backpack:FindFirstChild(itemName) do
												game.ReplicatedStorage.PawnRemote:FireServer(itemName)
												task.wait(0.05)
											end
										end
									end
								end
							end
						end)
						task.wait(1)
					end
				end)

				for _, v in pairs(workspace:GetDescendants()) do
					if v:IsA("ProximityPrompt") and v.Name == "ProximityPrompt" and v.Parent.Name == "DumpsterPromt" then
						v.HoldDuration = 0
						v.RequiresLineOfSight = false
					end
				end

				task.spawn(function()
					while getgenv().loottrash do
						task.wait()
						for _, v in pairs(workspace:GetDescendants()) do
							if not getgenv().loottrash then break end
							if v:IsA("ProximityPrompt") and v.Name == "ProximityPrompt" and v.Parent.Name == "DumpsterPromt" then
								local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
								if hrp then
									teleport(v.Parent.Position.X, v.Parent.Position.Y, v.Parent.Position.Z + 3)
								end
								workspace.CurrentCamera.CFrame = CFrame.new(workspace.CurrentCamera.CFrame.Position, v.Parent.Position)
								task.wait(0.3)
								for _ = 1, 10 do fireproximityprompt(v) end
								task.wait(0.1)
							end
						end
					end

					if originalPosition then
						teleport(originalPosition.X, originalPosition.Y, originalPosition.Z)
						originalPosition = nil
					end
				end)

			else
				getgenv().loottrash = false
				getgenv().SwimMethod = false
			end
		end
	})

local constructionRunning = false

	AutoFarm:AddToggle({
		Name = "🚧 Construction AutoFarm",
		Default = false,
		Callback = function(Value)
			local speaker = game:GetService("Players").LocalPlayer
			if not speaker then return end

			getgenv().SwimMethod = false

			local function enableSwimMethod()
				getgenv().SwimMethod = true
				task.wait(1)
			end

			local function disableSwimMethod()
				getgenv().SwimMethod = false
			end

			local function getCharacter()
				return speaker.Character or speaker.CharacterAdded:Wait()
			end

			local function getBackpack()
				return speaker:FindFirstChild("Backpack")
			end

			local function hasPlyWood()
				local backpack = getBackpack()
				local character = getCharacter()
				return (backpack and backpack:FindFirstChild("PlyWood")) or (character and character:FindFirstChild("PlyWood"))
			end

			local function equipPlyWood()
				local backpack = getBackpack()
				if backpack then
					local plyWood = backpack:FindFirstChild("PlyWood")
					if plyWood then
						plyWood.Parent = getCharacter()
					end
				end
			end

			local function fireInstantPrompt(prompt)
				if prompt and prompt:IsA("ProximityPrompt") and prompt.Enabled then
					prompt.HoldDuration = 0
					fireproximityprompt(prompt)
				end
			end

			local function grabWood()
				local char = getCharacter()
				char:SetPrimaryPartCFrame(CFrame.new(-1727, 371, -1178))
				task.wait(0.1)

				while constructionRunning and not hasPlyWood() do
					local prompt = workspace.ConstructionStuff["Grab Wood"]:FindFirstChildOfClass("ProximityPrompt")
					fireInstantPrompt(prompt)
					task.wait(0.1)
					equipPlyWood()
				end
			end

			local function buildWall(name, position)
				local prompt = workspace.ConstructionStuff[name]:FindFirstChildOfClass("ProximityPrompt")

				while constructionRunning and prompt and prompt.Enabled do
					getCharacter():SetPrimaryPartCFrame(position)
					fireInstantPrompt(prompt)
					task.wait(0.05)

					if not hasPlyWood() then
						grabWood()
					end
				end
			end

			local function quitJob()
				local quitPrompt = workspace.ConstructionStuff:FindFirstChild("Quit Job")
				if quitPrompt then
					local prompt = quitPrompt:FindFirstChildOfClass("ProximityPrompt")
					if prompt then
						getCharacter():SetPrimaryPartCFrame(quitPrompt.CFrame + Vector3.new(0, 2, 0))
						task.wait(0.2)
						fireInstantPrompt(prompt)
					end
				end
			end

			if Value then
				constructionRunning = true
				enableSwimMethod()
				getCharacter():SetPrimaryPartCFrame(CFrame.new(-1728, 371, -1172))
				task.wait(0.2)
				fireInstantPrompt(workspace.ConstructionStuff["Start Job"]:FindFirstChildOfClass("ProximityPrompt"))

				task.spawn(function()
					while constructionRunning do
						if not hasPlyWood() then
							grabWood()
						end

						buildWall("Wall2 Prompt", CFrame.new(-1705, 368, -1151))
						buildWall("Wall3 Prompt", CFrame.new(-1732, 368, -1152))
						buildWall("Wall4 Prompt2", CFrame.new(-1772, 368, -1152))
						buildWall("Wall1 Prompt3", CFrame.new(-1674, 368, -1166))

						task.wait(1)
					end
				end)
			else
				constructionRunning = false
				disableSwimMethod()
				quitJob()

				local startJobPrompt = workspace.ConstructionStuff["Start Job"]:FindFirstChildOfClass("ProximityPrompt")
				if startJobPrompt and startJobPrompt.Parent then
					local char = getCharacter()
					if char and char.PrimaryPart then
						char:SetPrimaryPartCFrame(startJobPrompt.Parent.CFrame + Vector3.new(0, 2, 0))
						task.wait(0.2) 
						fireInstantPrompt(startJobPrompt) 
					end
				end
			end
		end
	})

AutoFarm:AddToggle({
    Name = "Studio Autofarm",
    Default = false, 
    Callback = function(State)
        local RunService = game:GetService("RunService")
        local Players = game:GetService("Players")
        local LocalPlayer = Players.LocalPlayer
        
        getgenv().StudioAutofarmEnabled = State
        
        local function updateCharacterReferences()
            local playerCharacter = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
            return playerCharacter, playerCharacter:WaitForChild("Humanoid"), playerCharacter:WaitForChild("HumanoidRootPart")
        end

        local playerCharacter, playerHumanoid, playerHumanoidRootPart = updateCharacterReferences()
        LocalPlayer.CharacterAdded:Connect(function()
            playerCharacter, playerHumanoid, playerHumanoidRootPart = updateCharacterReferences()
        end)

        if State then
            studioOriginalPosition = playerCharacter and playerCharacter:GetPrimaryPartCFrame() or nil

            local function robStudio(studioPay)
                if not getgenv().StudioAutofarmEnabled then return end
                
                local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
                if not character then return end

                local studioPath = workspace.StudioPay.Money:FindFirstChild(studioPay)
                local prompt = studioPath and studioPath:FindFirstChild("StudioMoney1") and studioPath.StudioMoney1:FindFirstChild("Prompt")
                
                if prompt then
                    getgenv().SwimMethod = true
                    task.wait(0.5)

                    local targetPosition = prompt.Parent.Position + Vector3.new(0, 2, 0)
                    local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
                    if humanoidRootPart then
                        humanoidRootPart.CFrame = CFrame.new(targetPosition)
                    end
                    
                    getgenv().SwimMethod = false
                    task.wait(0.2)
                    
                    prompt.HoldDuration = 0
                    prompt.RequiresLineOfSight = false
                    
                    for i = 1, 3 do
                        pcall(function()
                            fireproximityprompt(prompt)
                        end)
                        task.wait(0.1)
                    end
                end
            end

            task.spawn(function()
                while getgenv().StudioAutofarmEnabled do
                    for _, pay in ipairs({"StudioPay1", "StudioPay2", "StudioPay3"}) do
                        if not getgenv().StudioAutofarmEnabled then break end
                        robStudio(pay)
                        task.wait(0.5)
                    end
                    
                    local character = LocalPlayer.Character
                    if character then
                        local humanoid = character:FindFirstChild("Humanoid")
                        if humanoid then
                            humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
                        end
                    end
                    
                    task.wait(0.5)
                end
            end)
        else
            getgenv().StudioAutofarmEnabled = false
            local character = LocalPlayer.Character
            if character then
                local humanoid = character:FindFirstChild("Humanoid")
                if humanoid then
                    humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
                end
                if studioOriginalPosition then
                    getgenv().SwimMethod = true
                    task.wait(0.5)
                    local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
                    if humanoidRootPart then
                        humanoidRootPart.CFrame = studioOriginalPosition
                    end
                    getgenv().SwimMethod = false
                    studioOriginalPosition = nil
                end
            end
        end
    end
})

AutoFarm:AddToggle({
    Name = "Deli Job Autofarm",
    Default = false,
    Callback = function(State)
        getgenv().DeliJobAutofarmEnabled = State
        if State then
            task.spawn(function()
                local LocalPlayer = Players.LocalPlayer
                local character = LocalPlayer.Character
                if not character then task.wait(0.1) return end
                
                local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
                if not humanoidRootPart then task.wait(0.1) return end
                
                local startJob = workspace.DeliJob.Start
                if startJob then
                    getgenv().SwimMethod = true
                    task.wait(0.5)
                    humanoidRootPart.CFrame = startJob.CFrame
                    getgenv().SwimMethod = false
                    task.wait(0.5)
                    
                    local startPrompt = startJob:FindFirstChild("Prompt")
                    if startPrompt then
                        for i = 1, 1 do
                            pcall(function()
                                fireproximityprompt(startPrompt)
                            end)
                            task.wait(0.1)
                        end
                    end
                end
                
                task.wait(1)
                
                while getgenv().DeliJobAutofarmEnabled do
                    local LocalPlayer = Players.LocalPlayer
                    local character = LocalPlayer.Character
                    if not character then task.wait(0.1) continue end
                    
                    local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
                    if not humanoidRootPart then task.wait(0.1) continue end
                    
                    local grabPrompt = workspace.DeliJob.GrabIngridence
                    if grabPrompt then
                        task.wait(0.5)
                        humanoidRootPart.CFrame = grabPrompt.CFrame
                        task.wait(0.5)
                        
                        local prompt = grabPrompt:FindFirstChild("Prompt")
                        if prompt then
                            for i = 1, 1 do
                                pcall(function()
                                    fireproximityprompt(prompt)
                                end)
                                task.wait(0.1)
                            end
                        end
                    end
                    
                    task.wait(1)
                    
                    local rawCheese = character:FindFirstChild("RawChopCheese")
                    if not rawCheese then
                        task.wait(1)
                        continue
                    end
                    
                    task.wait(1)
                    
                    local grills = workspace.DeliJob.Grills:GetChildren()
                    if grills[5] then
                        local grillSmoke = grills[5]:FindFirstChild("GrillSmoke")
                        if grillSmoke then
                            task.wait(0.5)
                            humanoidRootPart.CFrame = grillSmoke.CFrame
                            task.wait(0.5)
                            
                            local cookPrompt = grillSmoke:FindFirstChild("Prompt")
                            if cookPrompt then
                                for i = 1, 1 do
                                    pcall(function()
                                        fireproximityprompt(cookPrompt)
                                    end)
                                    task.wait(0.1)
                                end
                            end
                        end
                    end
                    
                    while getgenv().DeliJobAutofarmEnabled do
                        local cookedCheese = character:FindFirstChild("ChopCheese")
                        if cookedCheese then
                            local sellArea = workspace.DeliJob.Sell
                            if sellArea then
                                task.wait(0.5)
                                humanoidRootPart.CFrame = sellArea.CFrame
                                task.wait(0.5)
                                
                                local sellPrompt = sellArea:FindFirstChild("Prompt")
                                if sellPrompt then
                                    for i = 1, 5 do
                                        pcall(function()
                                            fireproximityprompt(sellPrompt)
                                        end)
                                        task.wait(0.1)
                                    end
                                end
                            end
                            break
                        end
                        
                        local grills = workspace.DeliJob.Grills:GetChildren()
                        if grills[5] then
                            local grillSmoke = grills[5]:FindFirstChild("GrillSmoke")
                            if grillSmoke then
                                task.wait(0.5)
                                humanoidRootPart.CFrame = grillSmoke.CFrame
                                task.wait(0.5)
                                
                                local cookPrompt = grillSmoke:FindFirstChild("Prompt")
                                if cookPrompt then
                                    pcall(function()
                                        fireproximityprompt(cookPrompt)
                                    end)
                                end
                            end
                        end
                        
                        task.wait(1)
                        task.wait(1)
                    end
                    
                    task.wait(2)
                end
            end)
        else
            task.spawn(function()
                local LocalPlayer = Players.LocalPlayer
                local character = LocalPlayer.Character
                if not character then return end
                
                local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
                if not humanoidRootPart then return end
                
                local originalPosition = humanoidRootPart.CFrame
                
                local startJob = workspace.DeliJob.Start
                if startJob then
                    getgenv().SwimMethod = true
                    task.wait(0.5)
                    humanoidRootPart.CFrame = startJob.CFrame
                    getgenv().SwimMethod = false
                    task.wait(0.5)
                    
                    local startPrompt = startJob:FindFirstChild("Prompt")
                    if startPrompt then
                        for i = 1, 1 do
                            pcall(function()
                                fireproximityprompt(startPrompt)
                            end)
                            task.wait(0.1)
                        end
                    end
                end
                
                task.wait(0.5)
                
                if originalPosition then
                    getgenv().SwimMethod = true
                    task.wait(0.5)
                    humanoidRootPart.CFrame = originalPosition
                    getgenv().SwimMethod = false
                end
            end)
        end
    end
})

Window:DrawCategory({
	Name = "Extra"
});

local SettingTab = Window:DrawTab({
	Icon = "settings-3",
	Name = "Settings",
	Type = "Single",
	EnableScrolling = true
});

local ThemeTab = Window:DrawTab({
	Icon = "paintbrush",
	Name = "Themes",
	Type = "Single"
});

local Settings = SettingTab:DrawSection({
	Name = "UI Settings",
});

Settings:AddToggle({
	Name = "Alway Show Frame",
	Default = false,
	Callback = function(v)
		Window.AlwayShowTab = v;
	end,
});

Settings:AddColorPicker({
	Name = "Highlight",
	Default = Compkiller.Colors.Highlight,
	Callback = function(v)
		Compkiller.Colors.Highlight = v;
		Compkiller:RefreshCurrentColor();
	end,
});

Settings:AddColorPicker({
	Name = "Toggle Color",
	Default = Color3.fromRGB(255, 0, 0),
	Callback = function(v)
		Compkiller.Colors.Toggle = v;

		Compkiller:RefreshCurrentColor(v);
	end,
});

Settings:AddColorPicker({
	Name = "Drop Color",
	Default = Compkiller.Colors.DropColor,
	Callback = function(v)
		Compkiller.Colors.DropColor = v;

		Compkiller:RefreshCurrentColor(v);
	end,
});

Settings:AddColorPicker({
	Name = "Risky",
	Default = Compkiller.Colors.Risky,
	Callback = function(v)
		Compkiller.Colors.Risky = v;

		Compkiller:RefreshCurrentColor(v);
	end,
});

Settings:AddColorPicker({
	Name = "Mouse Enter",
	Default = Compkiller.Colors.MouseEnter,
	Callback = function(v)
		Compkiller.Colors.MouseEnter = v;

		Compkiller:RefreshCurrentColor(v);
	end,
});

Settings:AddColorPicker({
	Name = "Block Color",
	Default = Color3.fromRGB(0, 0, 0),
	Callback = function(v)
		Compkiller.Colors.BlockColor = v;

		Compkiller:RefreshCurrentColor(v);
	end,
});

Settings:AddColorPicker({
	Name = "Background Color",
	Default = Color3.fromRGB(0, 0, 0),
	Callback = function(v)
		Compkiller.Colors.BGDBColor = v;

		Compkiller:RefreshCurrentColor(v);
	end,
});

Settings:AddColorPicker({
	Name = "Block Background Color",
	Default = Color3.fromRGB(0, 0, 0),
	Callback = function(v)
		Compkiller.Colors.BlockBackground = v;

		Compkiller:RefreshCurrentColor(v);
	end,
});

Settings:AddColorPicker({
	Name = "Stroke Color",
	Default = Color3.fromRGB(255, 0, 0),
	Callback = function(v)
		Compkiller.Colors.StrokeColor = v

		Compkiller:RefreshCurrentColor(v)
	end,
})

Settings:AddColorPicker({
	Name = "High Stroke Color",
	Default = Color3.fromRGB(255, 0, 0),
	Callback = function(v)
		Compkiller.Colors.HighStrokeColor = v;

		Compkiller:RefreshCurrentColor(v);
	end,
});

Settings:AddColorPicker({
	Name = "Switch Color",
	Default = Color3.fromRGB(255, 255, 255),
	Callback = function(v)
		Compkiller.Colors.SwitchColor = v;

		Compkiller:RefreshCurrentColor(v);
	end,
});

Settings:AddColorPicker({
	Name = "Line Color",
	Default = Compkiller.Colors.LineColor,
	Callback = function(v)
		Compkiller.Colors.LineColor = v;

		Compkiller:RefreshCurrentColor(v);
	end,
});

Settings:AddButton({
	Name = "Get Theme",
	Callback = function()
		print(Compkiller:GetTheme())

		Notifier.new({
			Title = "Notification",
			Content = "Copied Them Color to your clipboard",
			Duration = 5,
			Icon = "rbxassetid://120245531583106"
		});
	end,
});

ThemeTab:DrawSection({
	Name = "UI Themes"
}):AddDropdown({
	Name = "Select Theme",
	Default = "Default",
	Values = {
		"Default",
		"Dark Green",
		"Dark Blue",
		"Purple Rose",
		"Skeet"
	},
	Callback = function(v)
		Compkiller:SetTheme(v)
	end,
})

-- Creating Config Tab --
local ConfigUI = Window:DrawConfig({
	Name = "Config",
	Icon = "folder",
	Config = ConfigManager
});

ConfigUI:Init();

Embed on website

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