Global script
Key RequiredUniversal

Global script

Universal ScriptIsacrackIsacrack 80 views 254 executesUpdated Sep 1, 2026
Unrated
00
Lua Script•2762 lines (92042 chars)
-- ==============================================================================
-- GLOBAL SCRIPT (GS) v54 - ANTI-BAN & CLONE REMOVER EDITION (ALL EXECUTORS)
-- ==============================================================================

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local Lighting = game:GetService("Lighting")
local VirtualUser = game:GetService("VirtualUser")
local TeleportService = game:GetService("TeleportService")
local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

-- ===== OBTENCIÓN SEGURA DE LOCALPLAYER =====
local LP = Players.LocalPlayer
while not LP do
	task.wait()
	LP = Players.LocalPlayer
end
local Mouse = LP:GetMouse()

-- ==============================================================================
-- 🛡️ MOTOR ANTI-BAN & ANTI-KICK UNIVERSAL (BYPASS FE)
-- ==============================================================================
local antiKickActive = true
pcall(function()
	if typeof(hookmetamethod) == "function" and typeof(newcclosure) == "function" then
		local oldNamecall
		oldNamecall = hookmetamethod(game, "__namecall", newcclosure(function(self, ...)
			local method = getnamecallmethod()
			local args = {...}

			if not checkcaller() and antiKickActive then
				local mLower = tostring(method):lower()
				
				if mLower == "kick" and (self == LP or self == Players or self == game) then
					warn("[GS ANTI-BAN] Intento de Kick bloqueado con éxito:", tostring(args[1]))
					return nil
				end

				if mLower == "fireserver" or mLower == "invokeserver" then
					local rName = tostring(self.Name):lower()
					if rName:find("ban") or rName:find("kick") or rName:find("detect") or rName:find("cheat") 
					or rName:find("exploit") or rName:find("flag") or rName:find("report") or rName:find("anticheat") 
					or rName:find("security") or rName:find("telemetry") then
						warn("[GS ANTI-BAN] Envío de reporte de cheat bloqueado a:", self.Name)
						return nil
					end
				end
			end
			return oldNamecall(self, ...)
		end))

		local oldIndex
		oldIndex = hookmetamethod(game, "__index", newcclosure(function(self, key)
			if not checkcaller() and antiKickActive and (self == LP or self == Players) and tostring(key):lower() == "kick" then
				return newcclosure(function(...)
					warn("[GS ANTI-BAN] Intento de Kick por Index bloqueado.")
					return nil
				end)
			end
			return oldIndex(self, key)
		end))
	end
end)

-- ===== DETECCIÓN DE DISPOSITIVO =====
local isMobile = false
pcall(function()
	if UIS.TouchEnabled and not UIS.KeyboardEnabled then isMobile = true end
	local vSize = workspace.CurrentCamera and workspace.CurrentCamera.ViewportSize or Vector2.new(1000, 1000)
	if vSize.X < 800 or vSize.Y < 550 then isMobile = true end
end)

-- ===== PARENT GUI ANTI-CRASH =====
local function getSafeParent()
	local parent = nil
	if type(gethui) == "function" then
		pcall(function() parent = gethui() end)
	end
	if not parent then
		pcall(function() parent = game:GetService("CoreGui") end)
	end
	if not parent or not pcall(function() return parent.Name end) then
		parent = LP:WaitForChild("PlayerGui")
	end
	return parent
end

local guiParent = getSafeParent()

-- Limpieza de versiones previas
pcall(function()
	if guiParent:FindFirstChild("GS_V54") then guiParent.GS_V54:Destroy() end
	if LP.PlayerGui:FindFirstChild("GS_V54") then LP.PlayerGui.GS_V54:Destroy() end
	RunService:UnbindFromRenderStep("GS_AimbotV54")
end)

-- Variables de Personaje y Revive
local Character = LP.Character or LP.CharacterAdded:Wait()
local Humanoid = Character and Character:FindFirstChildOfClass("Humanoid")
local RootPart = Character and Character:FindFirstChild("HumanoidRootPart")
local realSpawnCFrame = RootPart and RootPart.CFrame or nil
local lastSafeCFrame = RootPart and RootPart.CFrame or nil

-- Coordenadas y Estados
local lastAliveCFrame = RootPart and RootPart.CFrame or nil
local autoReviveInSitu = true
local autoRemoteRevive = false
local preventDeathFE = false
local autoStandUp = true
local isDeadState = false
local autoFarmBABFT = false

-- Duplicador y Rastreador de Clones
local copiedObject = nil
local clickToDupe = false
local clickToDelete = false
local customObjectName = ""
local spawnedClones = {}

-- Multiplicador de Daño
local damageBoost = false
local damageMultiplier = 3
local fastFireRate = false
local isProcessingHit = false

-- Pegado a la Cabeza (Sticky Head)
local stickyHead = false
local stickyOffset = 1.8

-- 1ra Persona Lock
local firstPersonLock = false

-- ==============================================================================
-- MOTOR DE MULTIPLICACIÓN DE DAÑO Y CADENCIA
-- ==============================================================================
local function getEquippedTool()
	return Character and Character:FindFirstChildOfClass("Tool")
end

local function applyDamageBoostToTool(tool)
	if not tool or not tool:IsA("Tool") then return end
	pcall(function()
		for _, v in ipairs(tool:GetDescendants()) do
			if v:IsA("NumberValue") or v:IsA("IntValue") or v:IsA("DoubleConstrainedValue") then
				local n = string.lower(v.Name)
				if n:find("damage") or n:find("dmg") or n:find("power") or n:find("headshot") or n:find("hit") then
					if not v:FindFirstChild("GS_OrigDmg") then
						local orig = Instance.new("NumberValue", v)
						orig.Name = "GS_OrigDmg"
						orig.Value = v.Value
					end
					local baseVal = v:FindFirstChild("GS_OrigDmg") and v.GS_OrigDmg.Value or v.Value
					v.Value = baseVal * damageMultiplier
				elseif fastFireRate and (n:find("cooldown") or n:find("firerate") or n:find("delay") or n:find("wait") or n:find("reload")) then
					v.Value = 0.01
				end
			end
		end
	end)
end

local function executeMultiHit(tool)
	if not damageBoost or isProcessingHit or not tool or tool.Parent ~= Character then return end
	isProcessingHit = true

	applyDamageBoostToTool(tool)

	task.spawn(function()
		local extraHits = math.clamp(damageMultiplier - 1, 1, 8)
		for i = 1, extraHits do
			if not damageBoost or not tool or tool.Parent ~= Character then break end
			task.wait(0.03)
			pcall(function()
				tool:Activate()
				
				local handle = tool:FindFirstChild("Handle") or tool:FindFirstChildOfClass("BasePart")
				if handle and typeof(firetouchinterest) == "function" then
					for _, plr in ipairs(Players:GetPlayers()) do
						if plr ~= LP and plr.Character then
							local targetHrp = plr.Character:FindFirstChild("HumanoidRootPart") or plr.Character:FindFirstChild("Head")
							if targetHrp and RootPart and (targetHrp.Position - RootPart.Position).Magnitude <= 20 then
								firetouchinterest(handle, targetHrp, 0)
								task.wait(0.005)
								firetouchinterest(handle, targetHrp, 1)
							end
						end
					end
				end
			end)
		end
		isProcessingHit = false
	end)
end

local function hookToolActivation(tool)
	if not tool or not tool:IsA("Tool") then return end
	tool.Activated:Connect(function()
		if damageBoost then
			executeMultiHit(tool)
		end
	end)
end

-- ==============================================================================
-- 🧬 MOTOR DE DUPLICACIÓN & ELIMINACIÓN DE CLONES
-- ==============================================================================
local function forceArchivable(obj)
	if not obj then return end
	pcall(function()
		obj.Archivable = true
		for _, descendant in ipairs(obj:GetDescendants()) do
			descendant.Archivable = true
		end
	end)
end

local function registerClone(clone)
	if not clone then return end
	pcall(function()
		clone:SetAttribute("GS_ClonedObject", true)
	end)
	table.insert(spawnedClones, clone)
end

local function smartClone(instance)
	if not instance then return nil end
	forceArchivable(instance)
	local ok, clone = pcall(function()
		return instance:Clone()
	end)
	if ok and clone then
		registerClone(clone)
		return clone
	end
	return nil
end

local function duplicateWorkspaceObject(objeto, heightOffset)
	if not objeto or not objeto:IsDescendantOf(workspace) then return false end
	heightOffset = heightOffset or Vector3.new(0, 5, 0)
	
	local copia = smartClone(objeto)
	if copia then
		copia.Parent = workspace
		pcall(function()
			if copia:IsA("BasePart") then
				copia.CFrame = objeto.CFrame + heightOffset
			elseif copia:IsA("Model") then
				copia:PivotTo(objeto:GetPivot() + heightOffset)
			elseif copia:IsA("Tool") then
				local handle = copia:FindFirstChild("Handle") or copia:FindFirstChildOfClass("BasePart")
				if handle then
					handle.CFrame = handle.CFrame + heightOffset
				end
			end
		end)
		return true, copia.Name
	end
	return false, nil
end

-- Funciones de Eliminación de Clones
local function clearAllClones()
	local count = 0
	for i = #spawnedClones, 1, -1 do
		local obj = spawnedClones[i]
		if obj and obj.Parent then
			pcall(function() obj:Destroy() end)
			count = count + 1
		end
		table.remove(spawnedClones, i)
	end
	
	-- Escaneo adicional de respaldo en workspace
	for _, obj in ipairs(workspace:GetDescendants()) do
		if obj:GetAttribute("GS_ClonedObject") then
			pcall(function() obj:Destroy() end)
			count = count + 1
		end
	end
	notify("🧹 Se eliminaron " .. count .. " objetos clonados.", THEME.warning, 3)
end

local function deleteLastClone()
	while #spawnedClones > 0 do
		local obj = table.remove(spawnedClones)
		if obj and obj.Parent then
			local name = obj.Name
			pcall(function() obj:Destroy() end)
			notify("↩️ Último clon '" .. name .. "' eliminado.", THEME.warning, 2)
			return
		end
	end
	notify("No hay clones recientes para eliminar.", THEME.danger, 2)
end

local function deleteTargetUnderMouse()
	local target = Mouse.Target
	if target and not target:IsDescendantOf(Character) and target ~= workspace then
		local obj = target.Parent:IsA("Model") and target.Parent ~= workspace and not target.Parent:FindFirstChildOfClass("Humanoid") and target.Parent or target
		local name = obj.Name
		pcall(function() obj:Destroy() end)
		notify("🗑️ Objeto '" .. name .. "' eliminado del mapa.", THEME.warning, 2.5)
	else
		notify("Apunta con el ratón a un objeto válido.", THEME.warning, 2)
	end
end

local copyHighlight = Instance.new("Highlight")
copyHighlight.Name = "GS_DupeHighlight"
copyHighlight.FillColor = Color3.fromRGB(46, 204, 113)
copyHighlight.OutlineColor = Color3.fromRGB(255, 255, 255)
copyHighlight.FillTransparency = 0.4
copyHighlight.OutlineTransparency = 0
copyHighlight.Enabled = false
copyHighlight.Parent = guiParent

-- ==============================================================================
-- 👁️ FUNCIÓN DE 1RA PERSONA (LOCK FIRST PERSON)
-- ==============================================================================
local function setFirstPerson(enable)
	firstPersonLock = enable
	pcall(function()
		if enable then
			LP.CameraMode = Enum.CameraMode.LockFirstPerson
			LP.CameraMinZoomDistance = 0.5
			LP.CameraMaxZoomDistance = 0.5
		else
			LP.CameraMode = Enum.CameraMode.Classic
			LP.CameraMinZoomDistance = 0.5
			LP.CameraMaxZoomDistance = 128
		end
	end)
end

-- ==============================================================================
-- FUNCIÓN DE REVIVIR
-- ==============================================================================
local function revivePlayer(character)
	if not character then character = LP.Character end
	if not character then return end
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	if humanoid then
		humanoid.Health = humanoid.MaxHealth
		humanoid.WalkSpeed = 16
		humanoid.JumpPower = 50
		pcall(function() humanoid:ChangeState(Enum.HumanoidStateType.GettingUp) end)
	end
end

-- ===== SISTEMA DE KEYBINDS =====
local menuKey = Enum.KeyCode.Q
local menuKeyName = "Q"
local waitingForMenuKey = false
local hackKeybinds = {}
local waitingForHackKey = nil
local NONE_KEY = Enum.KeyCode.Unknown

local function registerKeybind(name, defKey, defName, func)
	hackKeybinds[name] = {
		key = defKey,
		keyName = defName,
		toggleFunc = func,
		default = {key = defKey, keyName = defName}
	}
end

local function resetAllKeybinds()
	menuKey = Enum.KeyCode.Q
	menuKeyName = "Q"
	for _, b in pairs(hackKeybinds) do
		b.key = NONE_KEY
		b.keyName = "Ninguno"
	end
end

-- ===== INVISIBILIDAD GLOBAL (FE) =====
local feInvisible = false
local originalMotorC0s = {}

local function setFEInvisibility(enable)
	feInvisible = enable
	local char = LP.Character
	if not char then return end
	local hrp = char:FindFirstChild("HumanoidRootPart")
	if enable then
		originalMotorC0s = {}
		for _, m in ipairs(char:GetDescendants()) do
			if m:IsA("Motor6D") and m.Name ~= "RootJoint" then
				originalMotorC0s[m] = m.C0
				m.C0 = m.C0 * CFrame.new(0, -99999, 0)
			end
		end
		if hrp then
			hrp.Transparency = 0.5
			hrp.Color = Color3.fromRGB(168, 85, 247)
			hrp.Material = Enum.Material.ForceField
		end
	else
		for m, c0 in pairs(originalMotorC0s) do
			if m and m.Parent then
				pcall(function() m.C0 = c0 end)
			end
		end
		originalMotorC0s = {}
		if hrp then hrp.Transparency = 1 end
	end
end

-- ===== FE GODMODE =====
local function applyFEGodmode()
	pcall(function()
		local char = LP.Character
		if not char then return end
		local hum = char:FindFirstChildOfClass("Humanoid")
		if not hum then return end

		local newHum = hum:Clone()
		newHum.Parent = char
		newHum.MaxHealth = hum.MaxHealth
		newHum.Health = hum.MaxHealth
		hum:Destroy()

		workspace.CurrentCamera.CameraSubject = newHum
		Character = char
		Humanoid = newHum
		newHum.BreakJointsOnDeath = false
		pcall(function() newHum:SetStateEnabled(Enum.HumanoidStateType.Dead, false) end)
	end)
end

-- MANEJADOR DE RESPAWN
local function updateChar(char)
	Character = char
	Humanoid = char:WaitForChild("Humanoid", 5)
	RootPart = char:WaitForChild("HumanoidRootPart", 5)
	if not realSpawnCFrame and RootPart then realSpawnCFrame = RootPart.CFrame end
	isDeadState = false

	revivePlayer(char)

	char.ChildAdded:Connect(function(child)
		if child:IsA("Tool") then
			hookToolActivation(child)
			applyDamageBoostToTool(child)
		end
	end)

	for _, child in ipairs(char:GetChildren()) do
		if child:IsA("Tool") then
			hookToolActivation(child)
			applyDamageBoostToTool(child)
		end
	end

	if autoReviveInSitu and lastAliveCFrame and RootPart then
		task.spawn(function()
			task.wait(0.05)
			for i = 1, 6 do
				if RootPart then
					RootPart.CFrame = lastAliveCFrame
					RootPart.AssemblyLinearVelocity = Vector3.new(0, 0, 0)
				end
				task.wait(0.04)
			end
		end)
	end

	if feInvisible then
		task.wait(0.6)
		setFEInvisibility(true)
	end

	if preventDeathFE then
		task.wait(0.5)
		applyFEGodmode()
	end

	if firstPersonLock then
		setFirstPerson(true)
	end
end
LP.CharacterAdded:Connect(updateChar)

-- RASTREADOR DE POSICIÓN VIVA
RunService.Heartbeat:Connect(function()
	pcall(function()
		if Character and RootPart and Humanoid and Humanoid.Health > 0 then
			lastAliveCFrame = RootPart.CFrame
		end

		if autoStandUp and Humanoid and Character then
			local state = Humanoid:GetState()
			if state == Enum.HumanoidStateType.FallingDown or state == Enum.HumanoidStateType.Ragdoll or state == Enum.HumanoidStateType.PlatformStanding or state == Enum.HumanoidStateType.Seated then
				pcall(function()
					Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
					Humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
					Humanoid.PlatformStand = false
					Humanoid.Sit = false
					Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
				end)
			end
		end
	end)
end)

-- BUCLE AUTO-REVIVE
task.spawn(function()
	while true do
		pcall(function()
			local char = LP.Character
			local hum = char and char:FindFirstChildOfClass("Humanoid")
			local deadNow = false

			if hum then
				deadNow = (hum.Health <= 0)
			elseif char then
				deadNow = (char:FindFirstChild("Head") == nil and char:FindFirstChild("HumanoidRootPart") == nil)
			else
				deadNow = true
			end

			if deadNow and not isDeadState then
				isDeadState = true
				revivePlayer(char)

				local pGui = LP:FindFirstChild("PlayerGui")
				if pGui then
					for _, b in ipairs(pGui:GetDescendants()) do
						if b:IsA("TextButton") or b:IsA("ImageButton") then
							local n = string.lower(b.Name)
							local txt = b:IsA("TextButton") and string.lower(b.Text) or ""
							if n:find("respawn") or n:find("revive") or n:find("play") or txt:find("respawn") or txt:find("revive") or txt:find("spawn") then
								pcall(function() b:Activate() end)
							end
						end
					end
				end

				task.wait(0.5)
				pcall(function() LP:LoadCharacter() end)
			end
		end)
		task.wait(0.4)
	end
end)

-- ===== RESOLVER DE OBJETIVOS UNIVERSAL =====
local function getPlayerCharacter(plr)
	if not plr then return nil end
	if plr.Character and plr.Character:IsDescendantOf(workspace) then return plr.Character end
	for _, obj in ipairs(workspace:GetDescendants()) do
		if obj:IsA("Model") and (obj.Name == plr.Name or obj.Name == plr.DisplayName) then
			if obj:FindFirstChildOfClass("Humanoid") or obj:FindFirstChild("Head") then
				return obj
			end
		end
	end
	return nil
end

local function getPlayerRoot(plr)
	if not plr then return nil end
	local char = getPlayerCharacter(plr)
	if not char then return nil end
	return char:FindFirstChild("HumanoidRootPart")
		or char:FindFirstChild("Torso")
		or char:FindFirstChild("UpperTorso")
		or char:FindFirstChild("Head")
		or char:FindFirstChildOfClass("BasePart")
end

-- ===== VARIABLES GENERALES =====
local defaultSpeed = 16
local flying, noclipping = false, false
local speeding, godMode, espOn, fullbright, noFog = false, false, false, false, false
local infJump, spinBot, antiVoid, antiAFK = false, false, false, false
local clickTP, instantPrompt, antiRagdoll, infiniteZoom = false, false, false, false
local flySpeed, runSpeed, jumpPower, spinSpeed = 70, 100, 100, 20
local unlockMouse, unlock3rdPerson = false, false

-- Aimbot
local aimOn = false
local aimPart = "Head"
local aimSmooth = 4
local aimPrediction = 0.12
local aimFOVRadius = 220
local aimShowFOV = false
local aimWallCheck = false
local aimTeamCheck = false
local aimTargetPlayer = nil
local aimOnlyOnRightClick = false

local tpTargetPlayer, tpPart = nil, "HumanoidRootPart"
local trollTargetPlayer = nil
local flyBV, flyBG = nil, nil
local savedPos = nil
local keys = {W = 0, A = 0, S = 0, D = 0, Up = 0, Down = 0}
local pickersToUpdate = {}
local afkConn = nil

local friendTargetPlayer = nil
local matchInfiltrator, infiltratorConn = false, nil

local killAura, killAuraRange = false, 18
local hitboxOn, hitboxSize = false, 15
local triggerbot = false
local autoClicker, autoClickCPS = false, 12
local bhop, airWalk = false, false
local xray, espNames = false, false
local hitboxOriginals, xrayOriginals = {}, {}
local originalPromptDurations = {}

local freecamOn, freecamSpeed = false, 2
local freecamRotX, freecamRotY = 0, 0
local freecamConn = nil
local airWalkPart = nil
local noFallDamage = false

-- ===== TEMA VISUAL DE LA UI =====
local THEME = {
	bg = Color3.fromRGB(12, 12, 18),
	bgLight = Color3.fromRGB(18, 18, 26),
	bgMid = Color3.fromRGB(24, 24, 34),
	bgCard = Color3.fromRGB(30, 30, 42),
	accent = Color3.fromRGB(130, 60, 255),
	accent2 = Color3.fromRGB(219, 39, 119),
	accent3 = Color3.fromRGB(59, 130, 246),
	text = Color3.fromRGB(245, 245, 255),
	textDim = Color3.fromRGB(160, 160, 180),
	textFade = Color3.fromRGB(100, 100, 120),
	success = Color3.fromRGB(46, 204, 113),
	warning = Color3.fromRGB(241, 196, 15),
	danger = Color3.fromRGB(231, 76, 60),
	stroke = Color3.fromRGB(45, 45, 65),
}

-- ScreenGui Principal
local SG = Instance.new("ScreenGui")
SG.Name = "GS_V54"
SG.ResetOnSpawn = false
SG.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
SG.Parent = guiParent

local function onTap(button, callback)
	button.Activated:Connect(callback)
end

-- Círculo FOV
local FOVCircle = Instance.new("Frame")
FOVCircle.Name = "AimFOV"
FOVCircle.AnchorPoint = Vector2.new(0.5, 0.5)
FOVCircle.Position = UDim2.new(0.5, 0, 0.5, 0)
FOVCircle.Size = UDim2.new(0, aimFOVRadius * 2, 0, aimFOVRadius * 2)
FOVCircle.BackgroundTransparency = 1
FOVCircle.Visible = false
FOVCircle.Parent = SG
Instance.new("UICorner", FOVCircle).CornerRadius = UDim.new(1, 0)
local fovStroke = Instance.new("UIStroke", FOVCircle)
fovStroke.Color = THEME.accent2
fovStroke.Thickness = 1.5

-- Notificaciones
local NotifHolder = Instance.new("Frame")
NotifHolder.Size = UDim2.new(0, 280, 1, -20)
NotifHolder.Position = UDim2.new(1, -290, 0, 10)
NotifHolder.BackgroundTransparency = 1
NotifHolder.Parent = SG
local nLay = Instance.new("UIListLayout", NotifHolder)
nLay.VerticalAlignment = Enum.VerticalAlignment.Bottom
nLay.Padding = UDim.new(0, 8)

local function notify(text, color, duration)
	color = color or THEME.accent
	duration = duration or 3
	local n = Instance.new("Frame")
	n.Size = UDim2.new(1, 0, 0, 46)
	n.BackgroundColor3 = THEME.bg
	n.Position = UDim2.new(1, 300, 0, 0)
	n.Parent = NotifHolder
	Instance.new("UICorner", n).CornerRadius = UDim.new(0, 10)
	local st = Instance.new("UIStroke", n)
	st.Color = color
	st.Thickness = 1.5

	local strip = Instance.new("Frame")
	strip.Size = UDim2.new(0, 4, 1, -8)
	strip.Position = UDim2.new(0, 4, 0, 4)
	strip.BackgroundColor3 = color
	strip.BorderSizePixel = 0
	strip.Parent = n
	Instance.new("UICorner", strip).CornerRadius = UDim.new(1, 0)

	local lbl = Instance.new("TextLabel")
	lbl.Size = UDim2.new(1, -20, 1, 0)
	lbl.Position = UDim2.new(0, 14, 0, 0)
	lbl.BackgroundTransparency = 1
	lbl.Text = text
	lbl.TextColor3 = THEME.text
	lbl.Font = Enum.Font.GothamMedium
	lbl.TextSize = 11
	lbl.TextXAlignment = Enum.TextXAlignment.Left
	lbl.TextWrapped = true
	lbl.Parent = n

	local function tween(obj, props, time, style, dir)
		if not obj then return end
		local t = TweenService:Create(obj, TweenInfo.new(time or 0.2, style or Enum.EasingStyle.Quad, dir or Enum.EasingDirection.Out), props)
		t:Play()
		return t
	end

	tween(n, {Position = UDim2.new(0, 0, 0, 0)}, 0.4, Enum.EasingStyle.Back)
	task.delay(duration, function()
		pcall(function()
			tween(n, {Position = UDim2.new(1, 300, 0, 0)}, 0.3)
			task.wait(0.35)
			n:Destroy()
		end)
	end)
end

-- Botón Flotante
local Circle = Instance.new("ImageButton")
Circle.Size = UDim2.new(0, 52, 0, 52)
Circle.Position = UDim2.new(0, 15, 0.4, 0)
Circle.BackgroundColor3 = THEME.accent
Circle.Image = "rbxthumb://type=AvatarHeadShot&id=" .. LP.UserId .. "&w=150&h=150"
Circle.Visible = false
Circle.ZIndex = 100
Circle.Parent = SG
Instance.new("UICorner", Circle).CornerRadius = UDim.new(1, 0)
local cStroke = Instance.new("UIStroke", Circle)
cStroke.Color = THEME.accent2
cStroke.Thickness = 2

-- Ventana Principal
local Main = Instance.new("Frame")
Main.Size = isMobile and UDim2.new(0, 390, 0, 470) or UDim2.new(0, 480, 0, 540)
Main.AnchorPoint = Vector2.new(0.5, 0.5)
Main.Position = UDim2.new(0.5, 0, 0.5, 0)
Main.BackgroundColor3 = THEME.bg
Main.BorderSizePixel = 0
Main.Parent = SG
Instance.new("UICorner", Main).CornerRadius = UDim.new(0, 14)
local mStroke = Instance.new("UIStroke", Main)
mStroke.Color = THEME.accent
mStroke.Thickness = 1.5

-- Top Bar
local Top = Instance.new("Frame")
Top.Size = UDim2.new(1, 0, 0, 52)
Top.BackgroundColor3 = THEME.accent
Top.BorderSizePixel = 0
Top.Parent = Main
Instance.new("UICorner", Top).CornerRadius = UDim.new(0, 14)

local TitleLbl = Instance.new("TextLabel")
TitleLbl.Size = UDim2.new(1, -120, 0, 22)
TitleLbl.Position = UDim2.new(0, 14, 0, 6)
TitleLbl.BackgroundTransparency = 1
TitleLbl.Text = "GLOBAL SCRIPT ⚡ [ANTI-BAN]"
TitleLbl.TextColor3 = Color3.fromRGB(255, 255, 255)
TitleLbl.Font = Enum.Font.GothamBold
TitleLbl.TextSize = 15
TitleLbl.TextXAlignment = Enum.TextXAlignment.Left
TitleLbl.Parent = Top

local SubTitleLbl = Instance.new("TextLabel")
SubTitleLbl.Size = UDim2.new(1, -120, 0, 16)
SubTitleLbl.Position = UDim2.new(0, 14, 0, 28)
SubTitleLbl.BackgroundTransparency = 1
SubTitleLbl.Text = "@" .. LP.Name .. " | Clone Cleaner Edition"
SubTitleLbl.TextColor3 = Color3.fromRGB(220, 210, 255)
SubTitleLbl.Font = Enum.Font.GothamMedium
SubTitleLbl.TextSize = 10
SubTitleLbl.TextXAlignment = Enum.TextXAlignment.Left
SubTitleLbl.Parent = Top

local function makeTopBtn(text, xOff, color)
	local b = Instance.new("TextButton")
	b.Size = UDim2.new(0, 34, 0, 34)
	b.Position = UDim2.new(1, xOff, 0, 9)
	b.BackgroundColor3 = color
	b.Text = text
	b.TextColor3 = Color3.fromRGB(255, 255, 255)
	b.Font = Enum.Font.GothamBold
	b.TextSize = 16
	b.AutoButtonColor = false
	b.Parent = Top
	Instance.new("UICorner", b).CornerRadius = UDim.new(0, 8)
	return b
end
local CloseBtn = makeTopBtn("X", -42, THEME.danger)
local MinBtn = makeTopBtn("-", -82, Color3.fromRGB(60, 60, 80))

-- Arrastre de Ventana
local pDrag, pStart, pPos
Top.InputBegan:Connect(function(i)
	if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then
		pDrag = true
		pStart = i.Position
		pPos = Main.Position
	end
end)
UIS.InputChanged:Connect(function(i)
	if pDrag and (i.UserInputType == Enum.UserInputType.MouseMovement or i.UserInputType == Enum.UserInputType.Touch) then
		local d = i.Position - pStart
		Main.Position = UDim2.new(pPos.X.Scale, pPos.X.Offset + d.X, pPos.Y.Scale, pPos.Y.Offset + d.Y)
	end
end)
UIS.InputEnded:Connect(function(i)
	if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then
		pDrag = false
	end
end)

-- Barra de Pestañas
local TabBar = Instance.new("ScrollingFrame")
TabBar.Size = UDim2.new(1, -16, 0, 36)
TabBar.Position = UDim2.new(0, 8, 0, 58)
TabBar.BackgroundColor3 = THEME.bgLight
TabBar.BorderSizePixel = 0
TabBar.ScrollBarThickness = 0
TabBar.ScrollingDirection = Enum.ScrollingDirection.X
TabBar.AutomaticCanvasSize = Enum.AutomaticSize.X
TabBar.Parent = Main
Instance.new("UICorner", TabBar).CornerRadius = UDim.new(0, 8)
local tabLayout = Instance.new("UIListLayout", TabBar)
tabLayout.FillDirection = Enum.FillDirection.Horizontal
tabLayout.Padding = UDim.new(0, 4)
local tabPad = Instance.new("UIPadding", TabBar)
tabPad.PaddingLeft = UDim.new(0, 4)
tabPad.PaddingTop = UDim.new(0, 4)

local Content = Instance.new("Frame")
Content.Size = UDim2.new(1, -16, 1, -125)
Content.Position = UDim2.new(0, 8, 0, 98)
Content.BackgroundColor3 = THEME.bgLight
Content.BorderSizePixel = 0
Content.ClipsDescendants = true
Content.Parent = Main
Instance.new("UICorner", Content).CornerRadius = UDim.new(0, 8)

local tabs = {
	{id = "combat", name = "Combate", icon = "🎯", color = Color3.fromRGB(239, 68, 68)},
	{id = "general", name = "Inicio", icon = "🏠", color = THEME.accent3},
	{id = "lobby", name = "Salas", icon = "🚪", color = Color3.fromRGB(168, 85, 247)},
	{id = "move", name = "Mover", icon = "🏃", color = Color3.fromRGB(34, 197, 94)},
	{id = "hacks", name = "Hacks", icon = "⚡", color = Color3.fromRGB(236, 72, 153)},
	{id = "visual", name = "Visual", icon = "👁", color = Color3.fromRGB(251, 191, 36)},
	{id = "tp", name = "TP", icon = "🌀", color = THEME.accent},
	{id = "troll", name = "Troll", icon = "🎭", color = Color3.fromRGB(249, 115, 22)},
	{id = "misc", name = "Extra", icon = "✨", color = Color3.fromRGB(244, 114, 182)},
	{id = "settings", name = "Ajustes", icon = "⚙", color = Color3.fromRGB(148, 163, 184)},
}

local tabBtns, tabPages = {}, {}
for _, t in ipairs(tabs) do
	local b = Instance.new("TextButton")
	b.Size = UDim2.new(0, 90, 0, 28)
	b.BackgroundColor3 = THEME.bgCard
	b.Text = t.icon .. " " .. t.name
	b.TextColor3 = THEME.textDim
	b.Font = Enum.Font.GothamBold
	b.TextSize = 10
	b.AutoButtonColor = false
	b.Parent = TabBar
	Instance.new("UICorner", b).CornerRadius = UDim.new(0, 6)
	tabBtns[t.id] = {btn = b, color = t.color}

	local page = Instance.new("ScrollingFrame")
	page.Size = UDim2.new(1, -8, 1, -8)
	page.Position = UDim2.new(0, 4, 0, 4)
	page.BackgroundTransparency = 1
	page.ScrollBarThickness = 4
	page.CanvasSize = UDim2.new(0, 0, 0, 0)
	page.Visible = false
	page.Parent = Content

	local pageLayout = Instance.new("UIListLayout", page)
	pageLayout.Padding = UDim.new(0, 6)
	pageLayout.SortOrder = Enum.SortOrder.LayoutOrder

	pageLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
		page.CanvasSize = UDim2.new(0, 0, 0, pageLayout.AbsoluteContentSize.Y + 24)
	end)

	tabPages[t.id] = page
end

local function switchTab(id)
	local function tween(obj, props, time, style, dir)
		if not obj then return end
		local t = TweenService:Create(obj, TweenInfo.new(time or 0.2, style or Enum.EasingStyle.Quad, dir or Enum.EasingDirection.Out), props)
		t:Play()
		return t
	end
	for k, v in pairs(tabBtns) do
		if k == id then
			tween(v.btn, {BackgroundColor3 = v.color, TextColor3 = Color3.fromRGB(255, 255, 255)}, 0.2)
		else
			tween(v.btn, {BackgroundColor3 = THEME.bgCard, TextColor3 = THEME.textDim}, 0.2)
		end
	end
	for k, p in pairs(tabPages) do
		p.Visible = (k == id)
	end
end
for id, v in pairs(tabBtns) do
	onTap(v.btn, function() switchTab(id) end)
end
switchTab("combat")

-- UI Helpers
local function section(p, t)
	local f = Instance.new("Frame")
	f.Size = UDim2.new(1, -4, 0, 24)
	f.BackgroundTransparency = 1
	f.Parent = p
	local bar = Instance.new("Frame")
	bar.Size = UDim2.new(0, 4, 0, 16)
	bar.Position = UDim2.new(0, 4, 0.5, -8)
	bar.BackgroundColor3 = THEME.accent
	bar.BorderSizePixel = 0
	bar.Parent = f
	Instance.new("UICorner", bar).CornerRadius = UDim.new(1, 0)
	local l = Instance.new("TextLabel")
	l.Size = UDim2.new(1, -16, 1, 0)
	l.Position = UDim2.new(0, 14, 0, 0)
	l.BackgroundTransparency = 1
	l.Text = t
	l.TextColor3 = Color3.fromRGB(210, 180, 255)
	l.Font = Enum.Font.GothamBold
	l.TextSize = 11
	l.TextXAlignment = Enum.TextXAlignment.Left
	l.Parent = f
end

local function mkToggle(p, label, get, set)
	local b = Instance.new("TextButton")
	b.Size = UDim2.new(1, -4, 0, 38)
	b.BackgroundColor3 = THEME.bgCard
	b.Text = ""
	b.AutoButtonColor = false
	b.Parent = p
	Instance.new("UICorner", b).CornerRadius = UDim.new(0, 8)
	local st = Instance.new("UIStroke", b)
	st.Color = THEME.stroke

	local lbl = Instance.new("TextLabel")
	lbl.Size = UDim2.new(1, -60, 1, 0)
	lbl.Position = UDim2.new(0, 12, 0, 0)
	lbl.BackgroundTransparency = 1
	lbl.Text = label
	lbl.TextColor3 = THEME.text
	lbl.Font = Enum.Font.GothamMedium
	lbl.TextSize = 11
	lbl.TextXAlignment = Enum.TextXAlignment.Left
	lbl.Parent = b

	local track = Instance.new("Frame")
	track.Size = UDim2.new(0, 40, 0, 20)
	track.Position = UDim2.new(1, -48, 0.5, -10)
	track.BackgroundColor3 = THEME.stroke
	track.BorderSizePixel = 0
	track.Parent = b
	Instance.new("UICorner", track).CornerRadius = UDim.new(1, 0)

	local knob = Instance.new("Frame")
	knob.Size = UDim2.new(0, 16, 0, 16)
	knob.Position = UDim2.new(0, 2, 0.5, -8)
	knob.BackgroundColor3 = Color3.fromRGB(220, 220, 235)
	knob.BorderSizePixel = 0
	knob.Parent = track
	Instance.new("UICorner", knob).CornerRadius = UDim.new(1, 0)

	local function paint()
		local function tween(obj, props, time, style, dir)
			if not obj then return end
			local t = TweenService:Create(obj, TweenInfo.new(time or 0.2, style or Enum.EasingStyle.Quad, dir or Enum.EasingDirection.Out), props)
			t:Play()
			return t
		end
		if get() then
			tween(track, {BackgroundColor3 = THEME.success}, 0.2)
			tween(knob, {Position = UDim2.new(0, 22, 0.5, -8)}, 0.2)
		else
			tween(track, {BackgroundColor3 = THEME.stroke}, 0.2)
			tween(knob, {Position = UDim2.new(0, 2, 0.5, -8)}, 0.2)
		end
	end
	onTap(b, function()
		set(not get())
		paint()
	end)
	paint()
	return b
end

local function mkBtn(p, t, cb)
	local b = Instance.new("TextButton")
	b.Size = UDim2.new(1, -4, 0, 36)
	b.BackgroundColor3 = THEME.bgCard
	b.Text = t
	b.TextColor3 = THEME.text
	b.Font = Enum.Font.GothamBold
	b.TextSize = 11
	b.AutoButtonColor = false
	b.Parent = p
	Instance.new("UICorner", b).CornerRadius = UDim.new(0, 8)
	local st = Instance.new("UIStroke", b)
	st.Color = THEME.accent
	onTap(b, function()
		local function tween(obj, props, time, style, dir)
			if not obj then return end
			local t = TweenService:Create(obj, TweenInfo.new(time or 0.2, style or Enum.EasingStyle.Quad, dir or Enum.EasingDirection.Out), props)
			t:Play()
			return t
		end
		tween(b, {BackgroundColor3 = THEME.accent}, 0.1)
		task.wait(0.1)
		tween(b, {BackgroundColor3 = THEME.bgCard}, 0.15)
		cb()
	end)
	return b
end

local function mkSlider(p, label, minV, maxV, default, cb)
	local w = Instance.new("Frame")
	w.Size = UDim2.new(1, -4, 0, 48)
	w.BackgroundColor3 = THEME.bgCard
	w.Parent = p
	Instance.new("UICorner", w).CornerRadius = UDim.new(0, 8)

	local lbl = Instance.new("TextLabel")
	lbl.Size = UDim2.new(1, -60, 0, 20)
	lbl.Position = UDim2.new(0, 10, 0, 2)
	lbl.BackgroundTransparency = 1
	lbl.Text = label
	lbl.TextColor3 = THEME.text
	lbl.Font = Enum.Font.GothamMedium
	lbl.TextSize = 11
	lbl.TextXAlignment = Enum.TextXAlignment.Left
	lbl.Parent = w

	local valLbl = Instance.new("TextLabel")
	valLbl.Size = UDim2.new(0, 45, 0, 18)
	valLbl.Position = UDim2.new(1, -50, 0, 3)
	valLbl.BackgroundColor3 = THEME.accent
	valLbl.BackgroundTransparency = 0.5
	valLbl.Text = tostring(default)
	valLbl.TextColor3 = Color3.fromRGB(255, 255, 255)
	valLbl.Font = Enum.Font.GothamBold
	valLbl.TextSize = 10
	valLbl.Parent = w
	Instance.new("UICorner", valLbl).CornerRadius = UDim.new(0, 4)

	local tr = Instance.new("Frame")
	tr.Size = UDim2.new(1, -20, 0, 8)
	tr.Position = UDim2.new(0, 10, 0, 30)
	tr.BackgroundColor3 = THEME.stroke
	tr.Parent = w
	Instance.new("UICorner", tr).CornerRadius = UDim.new(1, 0)

	local initFrac = math.clamp((default - minV) / (maxV - minV), 0, 1)
	local fl = Instance.new("Frame")
	fl.Size = UDim2.new(initFrac, 0, 1, 0)
	fl.BackgroundColor3 = THEME.accent
	fl.BorderSizePixel = 0
	fl.Parent = tr
	Instance.new("UICorner", fl).CornerRadius = UDim.new(1, 0)

	local dr = false
	local function sx(x)
		local r = math.clamp((x - tr.AbsolutePosition.X) / math.max(tr.AbsoluteSize.X, 1), 0, 1)
		fl.Size = UDim2.new(r, 0, 1, 0)
		local v = math.floor(minV + (maxV - minV) * r)
		valLbl.Text = tostring(v)
		cb(v)
	end
	tr.InputBegan:Connect(function(i)
		if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then
			dr = true
			sx(i.Position.X)
		end
	end)
	UIS.InputChanged:Connect(function(i)
		if dr and (i.UserInputType == Enum.UserInputType.MouseMovement or i.UserInputType == Enum.UserInputType.Touch) then
			sx(i.Position.X)
		end
	end)
	UIS.InputEnded:Connect(function(i)
		if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then
			dr = false
		end
	end)
end

local function mkDrop(p, title, opts, cb)
	local w = Instance.new("Frame")
	w.Size = UDim2.new(1, -4, 0, 36)
	w.BackgroundTransparency = 1
	w.Parent = p

	local b = Instance.new("TextButton")
	b.Size = UDim2.new(1, 0, 1, 0)
	b.BackgroundColor3 = THEME.bgCard
	b.Text = "  " .. title .. "  ▼"
	b.TextColor3 = THEME.text
	b.Font = Enum.Font.GothamMedium
	b.TextSize = 11
	b.TextXAlignment = Enum.TextXAlignment.Left
	b.AutoButtonColor = false
	b.Parent = w
	Instance.new("UICorner", b).CornerRadius = UDim.new(0, 8)

	local li = Instance.new("Frame")
	li.Size = UDim2.new(1, 0, 0, #opts * 30)
	li.Position = UDim2.new(0, 0, 0, 40)
	li.BackgroundColor3 = THEME.bgMid
	li.Visible = false
	li.ZIndex = 50
	li.Parent = w
	Instance.new("UICorner", li).CornerRadius = UDim.new(0, 8)
	Instance.new("UIListLayout", li)

	for _, o in ipairs(opts) do
		local ob = Instance.new("TextButton")
		ob.Size = UDim2.new(1, 0, 0, 30)
		ob.BackgroundColor3 = THEME.bgCard
		ob.Text = "  " .. o[1]
		ob.TextColor3 = THEME.text
		ob.Font = Enum.Font.GothamMedium
		ob.TextSize = 10
		ob.TextXAlignment = Enum.TextXAlignment.Left
		ob.ZIndex = 51
		ob.AutoButtonColor = false
		ob.Parent = li
		onTap(ob, function()
			b.Text = "  " .. o[1] .. "  ▼"
			li.Visible = false
			w.Size = UDim2.new(1, -4, 0, 36)
			cb(o[2])
		end)
	end
	onTap(b, function()
		li.Visible = not li.Visible
		w.Size = li.Visible and UDim2.new(1, -4, 0, 36 + li.Size.Y.Offset) or UDim2.new(1, -4, 0, 36)
	end)
end

local function mkInput(p, placeholder, cb)
	local w = Instance.new("Frame")
	w.Size = UDim2.new(1, -4, 0, 38)
	w.BackgroundColor3 = THEME.bgCard
	w.Parent = p
	Instance.new("UICorner", w).CornerRadius = UDim.new(0, 8)
	Instance.new("UIStroke", w).Color = THEME.stroke

	local tb = Instance.new("TextBox")
	tb.Size = UDim2.new(1, -16, 1, 0)
	tb.Position = UDim2.new(0, 8, 0, 0)
	tb.BackgroundTransparency = 1
	tb.PlaceholderText = placeholder
	tb.Text = ""
	tb.TextColor3 = THEME.text
	tb.Font = Enum.Font.GothamMedium
	tb.TextSize = 11
	tb.TextXAlignment = Enum.TextXAlignment.Left
	tb.ClearTextOnFocus = false
	tb.Parent = w

	tb.FocusLost:Connect(function()
		cb(tb.Text)
	end)
	return tb
end

local keybindButtons = {}
local function mkKeybindBtn(p, hackName, label)
	local w = Instance.new("Frame")
	w.Size = UDim2.new(1, -4, 0, 38)
	w.BackgroundColor3 = THEME.bgCard
	w.Parent = p
	Instance.new("UICorner", w).CornerRadius = UDim.new(0, 8)
	local st = Instance.new("UIStroke", w)
	st.Color = THEME.stroke

	local lbl = Instance.new("TextLabel")
	lbl.Size = UDim2.new(0.55, 0, 1, 0)
	lbl.Position = UDim2.new(0, 12, 0, 0)
	lbl.BackgroundTransparency = 1
	lbl.Text = label
	lbl.TextColor3 = THEME.text
	lbl.Font = Enum.Font.GothamMedium
	lbl.TextSize = 11
	lbl.TextXAlignment = Enum.TextXAlignment.Left
	lbl.Parent = w

	local keyBtn = Instance.new("TextButton")
	keyBtn.Size = UDim2.new(0, 100, 0, 26)
	keyBtn.Position = UDim2.new(1, -110, 0.5, -13)
	keyBtn.BackgroundColor3 = THEME.accent
	keyBtn.AutoButtonColor = false
	keyBtn.Font = Enum.Font.GothamBold
	keyBtn.TextSize = 11
	keyBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
	keyBtn.Parent = w
	Instance.new("UICorner", keyBtn).CornerRadius = UDim.new(0, 6)

	local function updateText()
		if hackName == "_MENU_" then
			keyBtn.Text = "[ " .. menuKeyName .. " ]"
		elseif hackKeybinds[hackName] then
			keyBtn.Text = "[ " .. hackKeybinds[hackName].keyName .. " ]"
		end
	end
	updateText()
	keybindButtons[hackName] = {btn = keyBtn, update = updateText}

	onTap(keyBtn, function()
		local function tween(obj, props, time, style, dir)
			if not obj then return end
			local t = TweenService:Create(obj, TweenInfo.new(time or 0.2, style or Enum.EasingStyle.Quad, dir or Enum.EasingDirection.Out), props)
			t:Play()
			return t
		end
		if hackName == "_MENU_" then
			waitingForMenuKey = true
			waitingForHackKey = nil
		else
			waitingForHackKey = hackName
			waitingForMenuKey = false
		end
		keyBtn.Text = "[ ... ]"
		tween(keyBtn, {BackgroundColor3 = THEME.warning}, 0.15)
		notify("Presiona una tecla para: " .. label, THEME.warning, 3)
	end)
end

-- ==============================================================================
-- SISTEMA DE BUSCADOR DE SELECCIÓN GENERAL (Aimbot, TP, Troll, etc.)
-- ==============================================================================
local function createPicker(parent, col, onSel, allowAll)
	local header = Instance.new("Frame")
	header.Size = UDim2.new(1, -4, 0, 48)
	header.BackgroundTransparency = 1
	header.Parent = parent

	local Card = Instance.new("Frame")
	Card.Size = UDim2.new(0.48, -2, 1, 0)
	Card.BackgroundColor3 = THEME.bgMid
	Card.Parent = header
	Instance.new("UICorner", Card).CornerRadius = UDim.new(0, 8)
	local cs = Instance.new("UIStroke", Card)
	cs.Color = col

	local CT = Instance.new("TextLabel")
	CT.Size = UDim2.new(1, -10, 1, 0)
	CT.Position = UDim2.new(0, 6, 0, 0)
	CT.BackgroundTransparency = 1
	CT.Text = allowAll and "🎯 AUTO" or "  Ninguno"
	CT.TextColor3 = THEME.textDim
	CT.Font = Enum.Font.GothamBold
	CT.TextSize = 10
	CT.TextXAlignment = Enum.TextXAlignment.Left
	CT.Parent = Card

	local searchWrap = Instance.new("Frame")
	searchWrap.Size = UDim2.new(0.5, 0, 1, 0)
	searchWrap.Position = UDim2.new(0.5, 0, 0, 0)
	searchWrap.BackgroundColor3 = THEME.bgCard
	searchWrap.Parent = header
	Instance.new("UICorner", searchWrap).CornerRadius = UDim.new(0, 8)

	local SB = Instance.new("TextBox")
	SB.Size = UDim2.new(1, -12, 1, 0)
	SB.Position = UDim2.new(0, 6, 0, 0)
	SB.BackgroundTransparency = 1
	SB.PlaceholderText = "🔍 Buscar..."
	SB.Text = ""
	SB.TextColor3 = THEME.text
	SB.Font = Enum.Font.GothamMedium
	SB.TextSize = 10
	SB.ClearTextOnFocus = false
	SB.Parent = searchWrap

	local Sc = Instance.new("ScrollingFrame")
	Sc.Size = UDim2.new(1, -4, 0, 92)
	Sc.BackgroundColor3 = THEME.bg
	Sc.ScrollBarThickness = 3
	Sc.AutomaticCanvasSize = Enum.AutomaticSize.Y
	Sc.Parent = parent
	Instance.new("UICorner", Sc).CornerRadius = UDim.new(0, 8)
	
	local scLayout = Instance.new("UIListLayout", Sc)
	scLayout.Padding = UDim.new(0, 4)
	scLayout.SortOrder = Enum.SortOrder.LayoutOrder
	
	local scP = Instance.new("UIPadding", Sc)
	scP.PaddingTop = UDim.new(0, 4)

	local pI = {}
	
	local function filt()
		local q = string.lower(SB.Text):gsub("%s+", "")
		for k, b in pairs(pI) do
			if q == "" then
				b.Visible = true
				b.LayoutOrder = 5
				if k == "closest" then
					b.TextColor3 = Color3.fromRGB(255, 120, 120)
					b.BackgroundColor3 = Color3.fromRGB(45, 20, 30)
				else
					b.TextColor3 = THEME.text
					b.BackgroundColor3 = THEME.bgCard
				end
			else
				local isMatch = false
				if typeof(k) == "string" then
					isMatch = (k:lower():find(q, 1, true) ~= nil)
				elseif k and k.Parent == Players then
					isMatch = ((k.DisplayName or ""):lower():find(q, 1, true) ~= nil or (k.Name or ""):lower():find(q, 1, true) ~= nil)
				end

				if isMatch then
					b.Visible = true
					b.LayoutOrder = 1
					b.TextColor3 = Color3.fromRGB(46, 204, 113)
					b.BackgroundColor3 = Color3.fromRGB(15, 40, 25)
				else
					b.Visible = false
					b.LayoutOrder = 10
				end
			end
		end
	end
	SB:GetPropertyChangedSignal("Text"):Connect(filt)

	local function pop()
		for _, v in ipairs(Sc:GetChildren()) do
			if v:IsA("TextButton") then v:Destroy() end
		end
		pI = {}
		if allowAll then
			local cb = Instance.new("TextButton")
			cb.Size = UDim2.new(1, -8, 0, 28)
			cb.BackgroundColor3 = Color3.fromRGB(45, 20, 30)
			cb.Text = "  🎯 AUTO"
			cb.TextColor3 = Color3.fromRGB(255, 120, 120)
			cb.Font = Enum.Font.GothamBold
			cb.TextSize = 10
			cb.TextXAlignment = Enum.TextXAlignment.Left
			cb.Parent = Sc
			Instance.new("UICorner", cb).CornerRadius = UDim.new(0, 6)
			onTap(cb, function()
				CT.Text = "🎯 AUTO"
				onSel(nil)
			end)
			pI["closest"] = cb
		end
		for _, plr in ipairs(Players:GetPlayers()) do
			if plr ~= LP then
				local b = Instance.new("TextButton")
				b.Size = UDim2.new(1, -8, 0, 28)
				b.BackgroundColor3 = THEME.bgCard
				b.Text = "  👤 " .. plr.DisplayName .. " (@" .. plr.Name .. ")"
				b.TextColor3 = THEME.text
				b.Font = Enum.Font.GothamMedium
				b.TextSize = 10
				b.TextXAlignment = Enum.TextXAlignment.Left
				b.Parent = Sc
				Instance.new("UICorner", b).CornerRadius = UDim.new(0, 6)
				onTap(b, function()
					CT.Text = plr.DisplayName
					onSel(plr)
				end)
				pI[plr] = b
			end
		end
		filt()
	end
	table.insert(pickersToUpdate, pop)
	pop()
end

Players.PlayerAdded:Connect(function()
	task.wait(0.5)
	for _, fn in ipairs(pickersToUpdate) do fn() end
end)
Players.PlayerRemoving:Connect(function(plr)
	if aimTargetPlayer == plr then aimTargetPlayer = nil end
	if trollTargetPlayer == plr then trollTargetPlayer = nil end
	task.wait(0.5)
	for _, fn in ipairs(pickersToUpdate) do fn() end
end)

-- ===== AIMBOT =====
local function isAlive(char)
	if not char then return false end
	local hum = char:FindFirstChildOfClass("Humanoid")
	if hum then return hum.Health > 0 end
	return char:FindFirstChild("Head") ~= nil
end

local function findPart(char, pref)
	if not char then return nil end
	for _, n in ipairs({pref, "Head", "HumanoidRootPart", "UpperTorso", "Torso"}) do
		local p = char:FindFirstChild(n)
		if p and p:IsA("BasePart") then return p end
	end
	return char:FindFirstChildOfClass("BasePart")
end

local function canSeeTarget(part)
	if not aimWallCheck then return true end
	local cam = workspace.CurrentCamera
	if not cam or not part then return true end
	local origin = cam.CFrame.Position
	local dir = part.Position - origin
	if dir.Magnitude < 0.1 then return true end
	local params = RaycastParams.new()
	params.FilterDescendantsInstances = {Character, cam}
	params.FilterType = Enum.RaycastFilterType.Exclude
	params.IgnoreWater = true
	local res = workspace:Raycast(origin, dir, params)
	if not res then return true end
	return res.Instance:IsDescendantOf(part.Parent)
end

local function getAimbotTarget()
	local cam = workspace.CurrentCamera
	if not cam then return nil end
	local center = Vector2.new(cam.ViewportSize.X / 2, cam.ViewportSize.Y / 2)

	if aimTargetPlayer then
		if aimTargetPlayer.Parent ~= Players then
			aimTargetPlayer = nil
			return nil
		end
		local char = getPlayerCharacter(aimTargetPlayer)
		if char and isAlive(char) then
			local part = findPart(char, aimPart)
			if part then
				local sp, vis = cam:WorldToViewportPoint(part.Position)
				if vis and sp.Z > 0 and canSeeTarget(part) then return part end
			end
		end
		return nil
	end

	local bestPart, bestDist = nil, aimFOVRadius
	for _, plr in ipairs(Players:GetPlayers()) do
		if plr ~= LP and plr.Character and not (aimTeamCheck and plr.Team and LP.Team and plr.Team == LP.Team) then
			local char = getPlayerCharacter(plr)
			if char and isAlive(char) then
				local part = findPart(char, aimPart)
				if part then
					local sp, vis = cam:WorldToViewportPoint(part.Position)
					if vis and sp.Z > 0 then
						local dist2D = (Vector2.new(sp.X, sp.Y) - center).Magnitude
						if dist2D < bestDist and canSeeTarget(part) then
							bestDist = dist2D
							bestPart = part
						end
					end
				end
			end
		end
	end
	return bestPart
end

RunService:BindToRenderStep("GS_AimbotV54", Enum.RenderPriority.Camera.Value + 1, function(dt)
	if not aimOn then return end
	if aimOnlyOnRightClick and not UIS:IsMouseButtonPressed(Enum.UserInputType.MouseButton2) and not isMobile then return end

	local cam = workspace.CurrentCamera
	if not cam then return end

	local targetPart = getAimbotTarget()
	if not targetPart then return end

	local targetPos = targetPart.Position
	if aimPrediction > 0 then
		local model = targetPart.Parent
		local hrp = model and (model:FindFirstChild("HumanoidRootPart") or model:FindFirstChild("Torso"))
		if hrp then
			local vel = hrp.AssemblyLinearVelocity
			if vel and vel == vel and vel.Magnitude > 1 then
				targetPos = targetPos + vel * ((targetPos - cam.CFrame.Position).Magnitude / 800) * aimPrediction
			end
		end
	end

	local screenPos, onScreen = cam:WorldToViewportPoint(targetPos)
	if not onScreen or screenPos.Z <= 0 then return end

	local center = Vector2.new(cam.ViewportSize.X / 2, cam.ViewportSize.Y / 2)
	local offset = Vector2.new(screenPos.X, screenPos.Y) - center
	local speedFactor = math.clamp((11 - aimSmooth) / 10, 0.1, 1)

	local moved = false
	if typeof(mousemoverel) == "function" then
		pcall(function()
			mousemoverel(offset.X * speedFactor, offset.Y * speedFactor)
			moved = true
		end)
	end
	if not moved then
		local camPos = cam.CFrame.Position
		local dir = targetPos - camPos
		if dir.Magnitude > 0.1 and dir == dir then
			cam.CFrame = cam.CFrame:Lerp(CFrame.lookAt(camPos, targetPos), math.clamp(speedFactor * dt * 35, 0.05, 1))
		end
	end
end)

-- FLY & FREECAM
local function toggleFreecam(enable)
	freecamOn = enable
	local Cam = workspace.CurrentCamera
	if not Cam then return end
	if enable then
		Cam.CameraType = Enum.CameraType.Scriptable
		local look = Cam.CFrame.LookVector
		freecamRotX = math.asin(look.Y)
		freecamRotY = math.atan2(-look.X, -look.Z)
		freecamConn = RunService.RenderStepped:Connect(function()
			if not freecamOn then return end
			local camera = workspace.CurrentCamera
			if not camera then return end
			local mv = Vector3.new(0, 0, 0)
			if UIS:IsKeyDown(Enum.KeyCode.W) then mv = mv + Vector3.new(0, 0, -1) end
			if UIS:IsKeyDown(Enum.KeyCode.S) then mv = mv + Vector3.new(0, 0, 1) end
			if UIS:IsKeyDown(Enum.KeyCode.A) then mv = mv + Vector3.new(-1, 0, 0) end
			if UIS:IsKeyDown(Enum.KeyCode.D) then mv = mv + Vector3.new(1, 0, 0) end
			if UIS:IsKeyDown(Enum.KeyCode.Space) then mv = mv + Vector3.new(0, 1, 0) end
			if UIS:IsKeyDown(Enum.KeyCode.LeftShift) then mv = mv + Vector3.new(0, -1, 0) end
			if UIS:IsMouseButtonPressed(Enum.UserInputType.MouseButton2) or isMobile then
				local d = UIS:GetMouseDelta()
				freecamRotY = freecamRotY - d.X * 0.004
				freecamRotX = math.clamp(freecamRotX - d.Y * 0.004, -1.4, 1.4)
			end
			local rot = CFrame.Angles(0, freecamRotY, 0) * CFrame.Angles(freecamRotX, 0, 0)
			camera.CFrame = CFrame.new(camera.CFrame.Position) * rot + rot:VectorToWorldSpace(mv) * freecamSpeed
		end)
	else
		if freecamConn then freecamConn:Disconnect(); freecamConn = nil end
		Cam.CameraType = Enum.CameraType.Custom
		local hum = Character and Character:FindFirstChildOfClass("Humanoid")
		if hum then Cam.CameraSubject = hum end
	end
end

local function startFly()
	if not RootPart or not Humanoid then return end
	flying = true
	Humanoid.PlatformStand = true
	if flyBV then flyBV:Destroy() end
	if flyBG then flyBG:Destroy() end
	flyBV = Instance.new("BodyVelocity")
	flyBV.MaxForce = Vector3.new(1e6, 1e6, 1e6)
	flyBV.Parent = RootPart
	flyBG = Instance.new("BodyGyro")
	flyBG.MaxTorque = Vector3.new(1e6, 1e6, 1e6)
	flyBG.P = 9000
	flyBG.Parent = RootPart
end

local function stopFly()
	flying = false
	if Humanoid then Humanoid.PlatformStand = false end
	if flyBV then flyBV:Destroy(); flyBV = nil end
	if flyBG then flyBG:Destroy(); flyBG = nil end
end

-- ==============================================================================
-- SISTEMA DE KEYBINDS GENERALES
-- ==============================================================================
registerKeybind("fly", NONE_KEY, "Ninguno", function() if flying then stopFly() else startFly() end; notify(flying and "Fly ON" or "Fly OFF", THEME.accent, 1) end)
registerKeybind("noclip", NONE_KEY, "Ninguno", function() noclipping = not noclipping; notify(noclipping and "Noclip ON" or "Noclip OFF", THEME.accent2, 1) end)
registerKeybind("speed", NONE_KEY, "Ninguno", function() speeding = not speeding; if not speeding and Humanoid then Humanoid.WalkSpeed = defaultSpeed end; notify(speeding and "Speed ON" or "Speed OFF", THEME.success, 1) end)
registerKeybind("invisible", NONE_KEY, "Ninguno", function() setFEInvisibility(not feInvisible); notify(feInvisible and "👻 Invisible ON" or "Visible", feInvisible and THEME.success or THEME.danger, 1) end)
registerKeybind("aimbot", NONE_KEY, "Ninguno", function() aimOn = not aimOn; notify(aimOn and "🎯 Aimbot ON" or "Aimbot OFF", aimOn and THEME.success or THEME.danger, 1) end)
registerKeybind("esp", NONE_KEY, "Ninguno", function() espOn = not espOn; if not espOn then for _, plr in ipairs(Players:GetPlayers()) do if plr.Character and plr.Character:FindFirstChild("GS_HL") then plr.Character.GS_HL:Destroy() end end end; notify(espOn and "ESP ON" or "ESP OFF", THEME.warning, 1) end)
registerKeybind("firstperson", NONE_KEY, "Ninguno", function() setFirstPerson(not firstPersonLock); notify(firstPersonLock and "👁️ 1ra Persona ON" or "1ra Persona OFF", THEME.accent, 1.5) end)

-- ACCIÓN DE PASO 1: COPIAR OBJETO CON TECLA C (O CONFIGURADA)
registerKeybind("copyMouseTarget", Enum.KeyCode.C, "C", function()
	local target = Mouse.Target
	if target then
		local objToCopy = target.Parent:IsA("Model") and target.Parent ~= workspace and not target.Parent:FindFirstChildOfClass("Humanoid") and target.Parent or target
		copiedObject = objToCopy
		
		copyHighlight.Adornee = copiedObject
		copyHighlight.Enabled = true
		
		notify("📋 Copiado: '" .. copiedObject.Name .. "'. ¡Haz CLICK DERECHO donde quieras colocarlo!", THEME.success, 4)
	else
		notify("Apunta con el ratón a un objeto válido.", THEME.warning, 2)
	end
end)

-- TECLA PARA BORRAR OBJETO EN LA MIRA DEL RATÓN (TECLA X POR DEFECTO)
registerKeybind("deleteMouseTarget", Enum.KeyCode.X, "X", function()
	deleteTargetUnderMouse()
end)

-- ================= PESTAÑAS =================

-- COMBATE
local c = tabPages.combat
section(c, "💥  MULTIPLICADOR DE DAÑO Y ATAQUE")
mkToggle(c, "💥 Multiplicador de Daño (Super Daño / Multi-Hit)", function() return damageBoost end, function(v)
	damageBoost = v
	notify(v and "💥 Multiplicador de Daño ACTIVADO (" .. damageMultiplier .. "x)" or "Multiplicador de Daño Desactivado", v and THEME.success or THEME.danger, 2.5)
end)
mkSlider(c, "Multiplicador de Golpes / Daño (2x - 10x)", 2, 10, 3, function(v)
	damageMultiplier = v
	local tool = getEquippedTool()
	if tool then applyDamageBoostToTool(tool) end
end)
mkToggle(c, "⚡ Cadencia Súper Rápida (Sin Cooldown)", function() return fastFireRate end, function(v)
	fastFireRate = v
	local tool = getEquippedTool()
	if tool then applyDamageBoostToTool(tool) end
	notify(v and "⚡ Cadencia Súper Rápida ACTIVADA" or "Cadencia Desactivada", v and THEME.success or THEME.danger, 2)
end)

section(c, "🎯  AIMBOT (RIVALS ENGINE)")
createPicker(c, THEME.danger, function(p) aimTargetPlayer = p end, true)
mkToggle(c, "Aimbot Activado", function() return aimOn end, function(v) aimOn = v end)
mkToggle(c, "Mostrar FOV", function() return aimShowFOV end, function(v) aimShowFOV = v; FOVCircle.Visible = v end)
mkDrop(c, "Parte: Cabeza", {{"Cabeza", "Head"}, {"Torso", "HumanoidRootPart"}, {"Pecho", "UpperTorso"}, {"Cadera", "LowerTorso"}}, function(v) aimPart = v end)
mkSlider(c, "Radio FOV", 50, 600, 220, function(v) aimFOVRadius = v; FOVCircle.Size = UDim2.new(0, v * 2, 0, v * 2) end)
mkSlider(c, "Suavidad (1=rápido 10=suave)", 1, 10, 4, function(v) aimSmooth = v end)
mkToggle(c, "Wallcheck", function() return aimWallCheck end, function(v) aimWallCheck = v end)
mkToggle(c, "Team Check", function() return aimTeamCheck end, function(v) aimTeamCheck = v end)
mkToggle(c, "Solo Click Derecho (PC)", function() return aimOnlyOnRightClick end, function(v) aimOnlyOnRightClick = v end)

section(c, "⚡  DISPARO")
mkToggle(c, "Triggerbot", function() return triggerbot end, function(v) triggerbot = v end)
mkToggle(c, "Auto-Clicker", function() return autoClicker end, function(v) autoClicker = v end)
mkSlider(c, "CPS", 1, 35, 12, function(v) autoClickCPS = v end)
mkToggle(c, "Kill Aura", function() return killAura end, function(v) killAura = v end)
mkSlider(c, "Rango Aura", 5, 50, 18, function(v) killAuraRange = v end)
mkToggle(c, "Hitbox Expander", function() return hitboxOn end, function(v)
	hitboxOn = v
	if not v then
		for p, s in pairs(hitboxOriginals) do pcall(function() p.Size = s; p.Transparency = 0 end) end
		hitboxOriginals = {}
	end
end)
mkSlider(c, "Tamaño Hitbox", 5, 40, 15, function(v) hitboxSize = v end)

-- INICIO
local g = tabPages.general
section(g, "🛡️  SUPERVIVENCIA & PROTECCIÓN")
mkToggle(g, "🛡️ Anti-Kick / Anti-Ban Bypass", function() return antiKickActive end, function(v) 
	antiKickActive = v
	notify(v and "🛡️ Protección Anti-Ban ACTIVA" or "Protección Anti-Ban Desactivada", v and THEME.success or THEME.danger, 2)
end)
mkToggle(g, "👻 Invisibilidad FE (Global)", function() return feInvisible end, function(v) setFEInvisibility(v) end)
mkToggle(g, "Modo Dios (God Mode)", function() return godMode end, function(v) godMode = v end)
mkToggle(g, "Anti-AFK", function() return antiAFK end, function(v)
	antiAFK = v
	if v then
		afkConn = LP.Idled:Connect(function()
			VirtualUser:CaptureController()
			VirtualUser:ClickButton2(Vector2.new(0, 0))
		end)
	elseif afkConn then
		afkConn:Disconnect()
	end
end)
section(g, "🎬  ACCIONES")
mkBtn(g, "🔄 Reiniciar Personaje", function() if Humanoid then Humanoid.Health = 0 end end)
mkBtn(g, "🔁 Rejoin al Servidor", function() TeleportService:Teleport(game.PlaceId, LP) end)

-- SALAS
local lob = tabPages.lobby
section(lob, "👥  BUSCADOR DE AMIGOS ONLINE")

local friendsContainer = Instance.new("Frame")
friendsContainer.Size = UDim2.new(1, -4, 0, 240)
friendsContainer.BackgroundTransparency = 1
friendsContainer.Parent = lob

local searchFriendWrap = Instance.new("Frame")
searchFriendWrap.Size = UDim2.new(1, 0, 0, 32)
searchFriendWrap.BackgroundColor3 = THEME.bgCard
searchFriendWrap.Parent = friendsContainer
Instance.new("UICorner", searchFriendWrap).CornerRadius = UDim.new(0, 8)
local searchFriendStroke = Instance.new("UIStroke", searchFriendWrap)
searchFriendStroke.Color = THEME.stroke

local SBFriends = Instance.new("TextBox")
SBFriends.Size = UDim2.new(1, -16, 1, 0)
SBFriends.Position = UDim2.new(0, 8, 0, 0)
SBFriends.BackgroundTransparency = 1
SBFriends.PlaceholderText = "🔍 Buscar amigo o juego en línea..."
SBFriends.Text = ""
SBFriends.TextColor3 = THEME.text
SBFriends.Font = Enum.Font.GothamMedium
SBFriends.TextSize = 11
SBFriends.ClearTextOnFocus = false
SBFriends.Parent = searchFriendWrap

local controlFrame = Instance.new("Frame")
controlFrame.Size = UDim2.new(1, 0, 0, 32)
controlFrame.Position = UDim2.new(0, 0, 0, 38)
controlFrame.BackgroundTransparency = 1
controlFrame.Parent = friendsContainer

local refBtn = mkBtn(controlFrame, "🔄 Actualizar Lista de Amigos", function() end)
refBtn.Size = UDim2.new(1, 0, 1, 0)

local sc = Instance.new("ScrollingFrame")
sc.Size = UDim2.new(1, 0, 1, -80)
sc.Position = UDim2.new(0, 0, 0, 76)
sc.BackgroundColor3 = THEME.bg
sc.ScrollBarThickness = 3
sc.CanvasSize = UDim2.new(0, 0, 0, 0)
sc.Parent = friendsContainer
Instance.new("UICorner", sc).CornerRadius = UDim.new(0, 8)

local scLayout = Instance.new("UIListLayout", sc)
scLayout.Padding = UDim.new(0, 4)
scLayout.SortOrder = Enum.SortOrder.LayoutOrder

local scPad = Instance.new("UIPadding", sc)
scPad.PaddingTop = UDim.new(0, 4)
scPad.PaddingLeft = UDim.new(0, 4)
scPad.PaddingRight = UDim.new(0, 4)

scLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
	sc.CanvasSize = UDim2.new(0, 0, 0, scLayout.AbsoluteContentSize.Y + 10)
end)

local createdFriendCards = {}

local function filterFriends()
	local q = string.lower(SBFriends.Text):gsub("%s+", "")
	for card, data in pairs(createdFriendCards) do
		if q == "" then
			card.Visible = true
			card.LayoutOrder = 5
			card.BackgroundColor3 = THEME.bgCard
			data.title.TextColor3 = THEME.text
			data.status.TextColor3 = data.defaultStatusColor
		else
			local nameMatch = data.displayName:lower():find(q, 1, true) or data.userName:lower():find(q, 1, true)
			local gameMatch = data.gamePlaying:lower():find(q, 1, true)

			if nameMatch or gameMatch then
				card.Visible = true
				card.LayoutOrder = 1
				card.BackgroundColor3 = Color3.fromRGB(15, 40, 25)
				data.title.TextColor3 = Color3.fromRGB(46, 204, 113)
				data.status.TextColor3 = Color3.fromRGB(150, 240, 180)
			else
				card.Visible = false
				card.LayoutOrder = 10
			end
		end
	end
end
SBFriends:GetPropertyChangedSignal("Text"):Connect(filterFriends)

local function refreshFriendsList(container)
	createdFriendCards = {}
	for _, item in ipairs(container:GetChildren()) do
		if not item:IsA("UIListLayout") and not item:IsA("UIPadding") then
			item:Destroy()
		end
	end

	local success, friends = pcall(function()
		return LP:GetFriendsOnline()
	end)

	if not success or not friends then
		local errLbl = Instance.new("TextLabel")
		errLbl.Size = UDim2.new(1, 0, 0, 30)
		errLbl.BackgroundTransparency = 1
		errLbl.Text = "❌ Error al conectar con amigos de Roblox"
		errLbl.TextColor3 = THEME.danger
		errLbl.Font = Enum.Font.GothamBold
		errLbl.TextSize = 10
		errLbl.Parent = container
		return
	end

	if #friends == 0 then
		local emptyLbl = Instance.new("TextLabel")
		emptyLbl.Size = UDim2.new(1, 0, 0, 30)
		emptyLbl.BackgroundTransparency = 1
		emptyLbl.Text = "Ningún amigo está jugando actualmente en línea."
		emptyLbl.TextColor3 = THEME.textDim
		emptyLbl.Font = Enum.Font.GothamMedium
		emptyLbl.TextSize = 10
		emptyLbl.Parent = container
		return
	end

	for _, friend in ipairs(friends) do
		local card = Instance.new("Frame")
		card.Size = UDim2.new(1, -4, 0, 48)
		card.BackgroundColor3 = THEME.bgCard
		card.Parent = container
		Instance.new("UICorner", card).CornerRadius = UDim.new(0, 8)
		local st = Instance.new("UIStroke", card)
		st.Color = THEME.stroke

		local title = Instance.new("TextLabel")
		title.Size = UDim2.new(0.6, 0, 0, 20)
		title.Position = UDim2.new(0, 8, 0, 4)
		title.BackgroundTransparency = 1
		title.Text = friend.DisplayName .. " (@" .. friend.UserName .. ")"
		title.TextColor3 = THEME.text
		title.Font = Enum.Font.GothamBold
		title.TextSize = 11
		title.TextXAlignment = Enum.TextXAlignment.Left
		title.Parent = card

		local gamePlayingName = friend.LastLocation or "Roblox"
		local statusText = "Desconectado"
		local presence = friend.Presence
		local canJoin = false
		local defaultStatusColor = THEME.textDim

		if presence == 2 then
			statusText = "🎮 Jugando a: " .. gamePlayingName
			canJoin = true
			defaultStatusColor = Color3.fromRGB(34, 197, 94)
		elseif presence == 1 then
			statusText = "📱 En línea (Menú principal o Web)"
		elseif presence == 3 then
			statusText = "🛠️ Editando en Roblox Studio"
		end

		local statusLbl = Instance.new("TextLabel")
		statusLbl.Size = UDim2.new(0.6, 0, 0, 16)
		statusLbl.Position = UDim2.new(0, 8, 0, 24)
		statusLbl.BackgroundTransparency = 1
		statusLbl.Text = statusText
		statusLbl.TextColor3 = defaultStatusColor
		statusLbl.Font = Enum.Font.GothamMedium
		statusLbl.TextSize = 9
		statusLbl.TextXAlignment = Enum.TextXAlignment.Left
		statusLbl.Parent = card

		createdFriendCards[card] = {
			friend = friend,
			title = title,
			status = statusLbl,
			displayName = friend.DisplayName,
			userName = friend.UserName,
			gamePlaying = gamePlayingName,
			defaultStatusColor = defaultStatusColor
		}

		if canJoin then
			local joinBtn = Instance.new("TextButton")
			joinBtn.Size = UDim2.new(0.35, 0, 0, 30)
			joinBtn.Position = UDim2.new(0.62, 0, 0.5, -15)
			joinBtn.BackgroundColor3 = THEME.accent
			joinBtn.Text = "⚡ UNIRSE"
			joinBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
			joinBtn.Font = Enum.Font.GothamBold
			joinBtn.TextSize = 10
			joinBtn.Parent = card
			Instance.new("UICorner", joinBtn).CornerRadius = UDim.new(0, 6)

			onTap(joinBtn, function()
				notify("Conectando al juego: " .. gamePlayingName, THEME.warning, 4)
				task.spawn(function()
					pcall(function()
						if friend.GameId and friend.GameId ~= "" then
							TeleportService:TeleportToPlaceInstance(friend.PlaceId, friend.GameId, LP)
						else
							TeleportService:Teleport(friend.PlaceId, LP)
						end
					end)
				end)
			end)
		else
			if presence == 2 and tostring(friend.GameId) == tostring(game.JobId) then
				local targetBtn = Instance.new("TextButton")
				targetBtn.Size = UDim2.new(0.35, 0, 0, 30)
				targetBtn.Position = UDim2.new(0.62, 0, 0.5, -15)
				targetBtn.BackgroundColor3 = THEME.accent3
				targetBtn.Text = "🎯 FIJAR"
				targetBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
				targetBtn.Font = Enum.Font.GothamBold
				targetBtn.TextSize = 10
				targetBtn.Parent = card
				Instance.new("UICorner", targetBtn).CornerRadius = UDim.new(0, 6)

				onTap(targetBtn, function()
					local targetPlr = Players:FindFirstChild(friend.UserName)
					if targetPlr then
						friendTargetPlayer = targetPlr
						notify("Fijado: " .. friend.DisplayName .. " como objetivo del servidor.", THEME.success, 3)
					else
						notify("No se encontró al jugador físicamente en el mapa.", THEME.danger, 2.5)
					end
				end)
			end
		end
	end
	filterFriends()
end

onTap(refBtn, function()
	refreshFriendsList(sc)
end)

task.spawn(function()
	task.wait(1)
	refreshFriendsList(sc)
end)

section(lob, "🚪  BYPASS DE TELEPORT")
mkToggle(lob, "🔗 Soldarse al Amigo (Requiere Fijar)", function() return matchInfiltrator end, function(v)
	matchInfiltrator = v
	if v then
		if not friendTargetPlayer then
			notify("Fija a un amigo antes de activar esto usando [🎯 FIJAR]", THEME.warning, 4)
			matchInfiltrator = false
			return
		end
		infiltratorConn = RunService.Heartbeat:Connect(function()
			if matchInfiltrator and friendTargetPlayer and RootPart then
				local fR = getPlayerRoot(friendTargetPlayer)
				if fR then
					noclipping = true
					RootPart.CFrame = fR.CFrame * CFrame.new(0, 0.2, 0)
					RootPart.AssemblyLinearVelocity = Vector3.new(0, 0, 0)
				end
			else
				if infiltratorConn then infiltratorConn:Disconnect(); infiltratorConn = nil end
			end
		end)
	elseif not v and infiltratorConn then
		infiltratorConn:Disconnect()
		infiltratorConn = nil
	end
end)

mkBtn(lob, "🧱 Destruir Barreras / Paredes", function()
	local count = 0
	for _, p in ipairs(workspace:GetDescendants()) do
		if p:IsA("BasePart") and not p:IsDescendantOf(Character) then
			local n = p.Name:lower()
			if n:find("barrier") or n:find("wall") or n:find("invisible") or n:find("door") or n:find("blocker") or (p.Transparency == 1 and p.CanCollide) then
				p.CanCollide = false
				count = count + 1
			end
		end
	end
	noclipping = true
	notify("Destruidas " .. count .. " barreras!", THEME.success)
end)

-- ==============================================================================

-- MOVER
local m = tabPages.move
section(m, "🦘  SALTO")
mkBtn(m, "🚀 Súper Salto", doSuperJump)
mkSlider(m, "Fuerza Salto", 50, 500, 100, function(v)
	jumpPower = v
	if Humanoid then pcall(function() Humanoid.JumpPower = v; Humanoid.UseJumpPower = true end) end
end)
mkToggle(m, "Salto Infinito", function() return infJump end, function(v) infJump = v end)
section(m, "🕊️  VOLAR")
mkToggle(m, "Fly", function() return flying end, function(v) if v then startFly() else stopFly() end end)
mkSlider(m, "Velocidad Vuelo", 20, 300, 70, function(v) flySpeed = v end)
mkToggle(m, "AirWalk", function() return airWalk end, function(v)
	airWalk = v
	if not v and airWalkPart then airWalkPart:Destroy(); airWalkPart = nil end
end)
section(m, "⚡  VELOCIDAD")
mkToggle(m, "Super Velocidad", function() return speeding end, function(v)
	speeding = v
	if not v and Humanoid then Humanoid.WalkSpeed = defaultSpeed end
end)
mkSlider(m, "WalkSpeed", 16, 400, 100, function(v) runSpeed = v end)

-- HACKS
local hk = tabPages.hacks
section(hk, "🌀  UTILIDADES")
mkToggle(hk, "Noclip", function() return noclipping end, function(v)
	noclipping = v
	if not v and Character then
		for _, p in ipairs(Character:GetDescendants()) do
			if p:IsA("BasePart") then p.CanCollide = true end
		end
	end
end)
mkToggle(hk, "Spinbot", function() return spinBot end, function(v) spinBot = v end)
mkSlider(hk, "Vel. Spinbot", 5, 60, 20, function(v) spinSpeed = v end)
mkToggle(hk, "Click TP", function() return clickTP end, function(v) clickTP = v end)
mkToggle(hk, "Instant Prompt", function() return instantPrompt end, function(v)
	instantPrompt = v
	for _, pr in ipairs(workspace:GetDescendants()) do
		if pr:IsA("ProximityPrompt") then
			if v then
				if not originalPromptDurations[pr] then originalPromptDurations[pr] = pr.HoldDuration end
				pr.HoldDuration = 0
			else
				if originalPromptDurations[pr] then pr.HoldDuration = originalPromptDurations[pr] end
			end
		end
	end
end)
mkToggle(hk, "Bhop", function() return bhop end, function(v) bhop = v end)

-- VISUAL
local vi = tabPages.visual
section(vi, "👁️  ESP")
mkToggle(vi, "ESP Highlight", function() return espOn end, function(on)
	espOn = on
	if not on then
		for _, plr in ipairs(Players:GetPlayers()) do
			if plr.Character and plr.Character:FindFirstChild("GS_HL") then plr.Character.GS_HL:Destroy() end
		end
	end
end)
mkToggle(vi, "ESP Nombres/Distancia", function() return espNames end, function(on)
	espNames = on
	if not on then
		for _, plr in ipairs(Players:GetPlayers()) do
			if plr.Character and plr.Character:FindFirstChild("Head") and plr.Character.Head:FindFirstChild("GS_TAG") then
				plr.Character.Head.GS_TAG:Destroy()
			end
		end
	end
end)
mkToggle(vi, "X-Ray", function() return xray end, function(on)
	xray = on
	for _, part in ipairs(workspace:GetDescendants()) do
		if part:IsA("BasePart") and not part:IsDescendantOf(Character) and not part.Parent:FindFirstChildOfClass("Humanoid") then
			if on then
				if not xrayOriginals[part] then xrayOriginals[part] = part.Transparency end
				part.Transparency = 0.65
			else
				if xrayOriginals[part] then part.Transparency = xrayOriginals[part] end
			end
		end
	end
	if not on then xrayOriginals = {} end
end)

section(vi, "📹  CÁMARA & PRIMERA PERSONA")
mkToggle(vi, "👁️ Forzar 1ra Persona (Lock)", function() return firstPersonLock end, function(val)
	setFirstPerson(val)
	notify(val and "👁️ Bloqueado en 1ra Persona" or "Modo Normal", val and THEME.success or THEME.danger, 2)
end)
mkToggle(vi, "Freecam", function() return freecamOn end, function(val) toggleFreecam(val) end)
mkSlider(vi, "Vel. Freecam", 1, 10, 2, function(val) freecamSpeed = val end)
mkToggle(vi, "Zoom Infinito", function() return infiniteZoom end, function(val)
	infiniteZoom = val
	LP.CameraMaxZoomDistance = val and 100000 or 128
end)

section(vi, "💡  ILUMINACIÓN")
mkToggle(vi, "Fullbright", function() return fullbright end, function(on)
	fullbright = on
	Lighting.Brightness = on and 2 or 1
	Lighting.GlobalShadows = not on
end)
mkToggle(vi, "Sin Niebla", function() return noFog end, function(on)
	noFog = on
	Lighting.FogEnd = on and 1e9 or 1e5
end)

-- TP
local t = tabPages.tp
section(t, "🌀  TELEPORT")
createPicker(t, THEME.accent, function(p) tpTargetPlayer = p end, false)
mkDrop(t, "Parte: Torso", {{"Cabeza", "Head"}, {"Cuerpo", "HumanoidRootPart"}, {"Pecho", "UpperTorso"}, {"Pie", "LeftFoot"}}, function(v) tpPart = v end)
mkBtn(t, "🚀 Teletransportarse", function()
	if tpTargetPlayer and RootPart then
		local d = findPart(getPlayerCharacter(tpTargetPlayer), tpPart)
		if d then RootPart.CFrame = d.CFrame * CFrame.new(0, 2, 2) end
	end
end)
section(t, "⚡  POSICIONES")
mkBtn(t, "🏠 Spawn", function() if RootPart and realSpawnCFrame then RootPart.CFrame = realSpawnCFrame end end)
mkBtn(t, "💾 Guardar Pos", function() if RootPart then savedPos = RootPart.CFrame; notify("Guardada", THEME.success) end end)
mkBtn(t, "📥 Cargar Pos", function() if savedPos and RootPart then RootPart.CFrame = savedPos end end)

-- ==============================================================================
-- 🎭 TROLL (CON PEGADO A LA CABEZA INFINITO)
-- ==============================================================================
local tr = tabPages.troll
section(tr, "🎭  SELECCIONAR VÍCTIMA")
createPicker(tr, Color3.fromRGB(249, 115, 22), function(p) trollTargetPlayer = p end, false)

section(tr, "👑  MODO PARÁSITO (PEGADO A CABEZA)")
mkToggle(tr, "👑 Pegarse a la Cabeza (Infinito / Parásito)", function() return stickyHead end, function(v)
	stickyHead = v
	if v then
		if not trollTargetPlayer then
			notify("¡Selecciona a un jugador primero en el buscador!", THEME.warning, 3.5)
			stickyHead = false
			return
		end
		notify("👑 ¡Pegado a la cabeza de " .. trollTargetPlayer.DisplayName .. "!", THEME.success, 3)
	else
		notify("Despegado de la cabeza.", THEME.danger, 2)
	end
end)

mkSlider(tr, "Altura sobre la cabeza", 0, 10, 2, function(v)
	stickyOffset = v
end)

section(tr, "🌀  OTRAS ACCIONES TROLL")
mkBtn(tr, "🌀 Fling a Víctima", function()
	if trollTargetPlayer and RootPart then
		local tR = getPlayerRoot(trollTargetPlayer)
		if tR then
			local old = RootPart.CFrame
			local bav = Instance.new("BodyAngularVelocity")
			bav.MaxTorque = Vector3.new(1e8, 1e8, 1e8)
			bav.AngularVelocity = Vector3.new(10000, 10000, 10000)
			bav.Parent = RootPart
			for i = 1, 35 do
				if not tR or not tR.Parent then break end
				RootPart.CFrame = tR.CFrame * CFrame.new(math.random(-1, 1), 0, math.random(-1, 1))
				RootPart.AssemblyLinearVelocity = Vector3.new(9000, 9000, 9000)
				task.wait(0.03)
			end
			bav:Destroy()
			RootPart.CFrame = old
		end
	end
end)

mkBtn(tr, "👑 TP a Cabeza (1 Sola Vez)", function()
	if trollTargetPlayer and RootPart then
		local h = findPart(getPlayerCharacter(trollTargetPlayer), "Head")
		if h then RootPart.CFrame = h.CFrame * CFrame.new(0, stickyOffset, 0) end
	end
end)

-- ===== EXTRA / MISC (DUPLICADOR Y ELIMINADOR DE CLONES) =====
local ex = tabPages.misc

section(ex, "📦  DUPLICADOR DE OBJETOS EN WORKSPACE")

mkInput(ex, "🔍 Nombre del objeto en Workspace...", function(txt)
	customObjectName = txt
end)

mkBtn(ex, "✨   Duplicar Objeto por Nombre en Workspace (+5 Studs)", function()
	if customObjectName == "" then
		notify("¡Escribe el nombre del objeto primero!", THEME.warning, 2)
		return
	end
	local obj = workspace:FindFirstChild(customObjectName, true)
	if obj then
		local ok, name = duplicateWorkspaceObject(obj)
		if ok then
			notify("✨ Objeto '" .. name .. "' duplicado (+5 bloques)", THEME.success, 3)
		else
			notify("Error al duplicar '" .. customObjectName .. "'", THEME.danger, 2)
		end
	else
		notify("No se encontró '" .. customObjectName .. "' en Workspace", THEME.danger, 2.5)
	end
end)

mkBtn(ex, "🎯   Duplicar Objeto Apuntado con Mouse (+5 Studs)", function()
	local target = Mouse.Target
	if target then
		local objToClone = target.Parent:IsA("Model") and target.Parent ~= workspace and not target.Parent:FindFirstChildOfClass("Humanoid") and target.Parent or target
		local ok, name = duplicateWorkspaceObject(objToClone)
		if ok then
			notify("✨ Objeto '" .. name .. "' duplicado", THEME.success, 3)
		else
			notify("No se pudo duplicar el objeto", THEME.danger, 2)
		end
	else
		notify("Apunta a un objeto con la mira", THEME.warning, 2)
	end
end)

mkBtn(ex, "✋   Duplicar Objeto Equipado en Mano (Físico)", function()
	local tool = getEquippedTool()
	if tool then
		local ok, name = duplicateWorkspaceObject(tool)
		if ok then
			notify("✨ Objeto en mano '" .. name .. "' duplicado", THEME.success, 3)
		else
			notify("No se pudo duplicar el objeto en mano", THEME.danger, 2)
		end
	else
		notify("¡Equipa un objeto primero!", THEME.warning, 2)
	end
end)

mkToggle(ex, "🖱️   Click para Duplicar Objeto en Workspace", function() return clickToDupe end, function(v)
	clickToDupe = v
	if v and clickToDelete then clickToDelete = false end
	notify(v and "🖱️ Click en cualquier objeto para duplicarlo" or "Click Dupe Desactivado", v and THEME.success or THEME.danger, 2)
end)

section(ex, "🧹  LIMPIEZA DE OBJETOS CLONADOS EN EL SUELO")

mkBtn(ex, "🧹   Eliminar TODOS los Objetos Clonados", function()
	clearAllClones()
end)

mkBtn(ex, "↩️   Deshacer Último Objeto Clonado", function()
	deleteLastClone()
end)

mkBtn(ex, "🎯   Eliminar Objeto Apuntado con el Ratón", function()
	deleteTargetUnderMouse()
end)

mkToggle(ex, "❌   Clic para Eliminar Objeto Apuntado", function() return clickToDelete end, function(v)
	clickToDelete = v
	if v and clickToDupe then clickToDupe = false end
	notify(v and "❌ Modo Borrar: Haz clic sobre cualquier objeto para eliminarlo" or "Modo Borrar Desactivado", v and THEME.warning or THEME.danger, 2.5)
end)

section(ex, "⛵  BUILD A BOAT FOR TREASURE")
mkToggle(ex, "💰 Auto-Farm Oro (Ir al Cofre Final)", function() return autoFarmBABFT end, function(v)
	autoFarmBABFT = v
	if v then
		notify("💰 Auto-Farm Activado!", THEME.success, 3)
		task.spawn(function()
			while autoFarmBABFT do
				pcall(function()
					if Character and RootPart then
						noclipping = true
						for i = 1, 10 do
							if not autoFarmBABFT then break end
							RootPart.CFrame = CFrame.new(-50 + (i * 800), 50, 0)
							task.wait(0.6)
						end
						if autoFarmBABFT and RootPart then
							RootPart.CFrame = CFrame.new(100, -350, 9400)
							task.wait(4)
						end
					end
				end)
				task.wait(1)
			end
		end)
	else
		notify("Auto-Farm Desactivado", THEME.danger, 2)
	end
end)

section(ex, "💀  MOTOR DE REVIVIR & AUTO-REVIVE")
mkBtn(ex, "💖   Revivir Personaje (revivePlayer)", function()
	revivePlayer(LP.Character)
	notify("💖 revivePlayer ejecutado!", THEME.success, 3)
end)

mkToggle(ex, "🔄 Revive In-Situ (Reaparecer donde moriste)", function() return autoReviveInSitu end, function(v)
	autoReviveInSitu = v
end)

mkToggle(ex, "🛡️ Inmortalidad FE GodMode (Humanoid Swap)", function() return preventDeathFE end, function(v)
	preventDeathFE = v
	if v then applyFEGodmode(); notify("🛡️ Inmortalidad FE Aplicada", THEME.success, 3) end
end)

mkToggle(ex, "⚡ Auto-Levantarse (Anti-Knockout)", function() return autoStandUp end, function(v)
	autoStandUp = v
end)

section(ex, "☠️  ACCIONES DE MUERTE")
mkBtn(ex, "☠️   Morir / Suicidio Instantáneo", function()
	pcall(function()
		if Character then
			local hum = Character:FindFirstChildOfClass("Humanoid")
			if hum then hum.Health = 0 else Character:BreakJoints() end
		end
	end)
	notify("☠️ Personaje eliminado", THEME.danger, 2)
end)

section(ex, "🧹  ELIMINADOR DE OBJETOS DE INVENTARIO")
mkBtn(ex, "🗑️   Eliminar Objeto en Mano (Equipado)", function()
	local tool = getEquippedTool()
	if tool then
		local name = tool.Name
		tool:Destroy()
		notify("🗑️ Objeto '" .. name .. "' eliminado!", THEME.warning, 2.5)
	else
		notify("¡No tienes ningún objeto equipado!", THEME.danger, 2)
	end
end)

mkBtn(ex, "🧹   Eliminar TODOS los Objetos del Inventario", function()
	local count = 0
	local bp = LP:FindFirstChild("Backpack")
	if bp then
		for _, item in ipairs(bp:GetChildren()) do
			if item:IsA("Tool") then
				item:Destroy()
				count = count + 1
			end
		end
	end
	if Character then
		for _, item in ipairs(Character:GetChildren()) do
			if item:IsA("Tool") then
				item:Destroy()
				count = count + 1
			end
		end
	end
	notify("🧹 Eliminados " .. count .. " objetos del inventario!", THEME.danger, 3)
end)

section(ex, "🛡️  OTRAS PROTECCIONES")
mkToggle(ex, "Anti-Void (Rescate)", function() return antiVoid end, function(v) antiVoid = v end)
mkToggle(ex, "Sin Daño de Caída", function() return noFallDamage end, function(v)
	noFallDamage = v
	if Humanoid then Humanoid:SetStateEnabled(Enum.HumanoidStateType.Freefall, not v) end
end)

section(ex, "🖱️  RATÓN Y CÁMARA")
mkToggle(ex, "Desbloquear Ratón", function() return unlockMouse end, function(v) unlockMouse = v end)
mkToggle(ex, "Desbloquear 3ra Persona", function() return unlock3rdPerson end, function(v)
	unlock3rdPerson = v
	if v then
		pcall(function()
			LP.CameraMinZoomDistance = 0.5
			LP.CameraMaxZoomDistance = 200
			LP.CameraMode = Enum.CameraMode.Classic
		end)
	else
		pcall(function() LP.CameraMode = Enum.CameraMode.LockFirstPerson end)
	end
end)

section(ex, "✨  OPTIMIZACIÓN")
mkBtn(ex, "🚀 FPS Booster", function()
	pcall(function()
		for _, v in ipairs(workspace:GetDescendants()) do
			if v:IsA("BasePart") then
				v.Material = Enum.Material.SmoothPlastic
			elseif v:IsA("Decal") or v:IsA("Texture") or v:IsA("ParticleEmitter") or v:IsA("Trail") or v:IsA("Beam") then
				v:Destroy()
			end
		end
		Lighting.GlobalShadows = false
		for _, ef in ipairs(Lighting:GetDescendants()) do
			if ef:IsA("PostEffect") then ef.Enabled = false end
		end
		notify("FPS Optimizado!", THEME.success)
	end)
end)

-- AJUSTES
local st = tabPages.settings
section(st, "🎮  TECLA PARA ABRIR MENÚ")
mkKeybindBtn(st, "_MENU_", "Abrir / Cerrar Menú")

section(st, "⌨️  ATAJOS (Sin tecla = desactivado)")
mkKeybindBtn(st, "fly", "Fly")
mkKeybindBtn(st, "noclip", "Noclip")
mkKeybindBtn(st, "speed", "Speed")
mkKeybindBtn(st, "invisible", "Invisible FE")
mkKeybindBtn(st, "aimbot", "Aimbot")
mkKeybindBtn(st, "esp", "ESP")
mkKeybindBtn(st, "firstperson", "Forzar 1ra Persona")
mkKeybindBtn(st, "copyMouseTarget", "Copiar Objeto del Ratón")
mkKeybindBtn(st, "deleteMouseTarget", "Borrar Objeto Apuntado")

section(st, "🔧  ACCIONES")
mkBtn(st, "🔄 Quitar TODOS los Atajos", function()
	resetAllKeybinds()
	for _, d in pairs(keybindButtons) do
		d.update()
		local function tween(obj, props, time, style, dir)
			if not obj then return end
			local t = TweenService:Create(obj, TweenInfo.new(time or 0.2, style or Enum.EasingStyle.Quad, dir or Enum.EasingDirection.Out), props)
			t:Play()
			return t
		end
		tween(d.btn, {BackgroundColor3 = THEME.accent}, 0.15)
	end
	notify("Atajos eliminados", THEME.success, 3)
end)
mkBtn(st, "🔄 Centrar Menú", function() Main.Position = UDim2.new(0.5, 0, 0.5, 0) end)

-- ===== CLICK EVENTOS =====
Mouse.Button1Down:Connect(function()
	if clickTP and RootPart and not UIS:GetFocusedTextBox() then
		RootPart.CFrame = CFrame.new(Mouse.Hit.Position + Vector3.new(0, 3, 0))
	end
	if clickToDupe and not UIS:GetFocusedTextBox() then
		local target = Mouse.Target
		if target then
			local obj = target.Parent:IsA("Model") and target.Parent ~= workspace and not target.Parent:FindFirstChildOfClass("Humanoid") and target.Parent or target
			local ok, name = duplicateWorkspaceObject(obj)
			if ok then
				notify("✨ Objeto '" .. name .. "' duplicado con Click!", THEME.success, 2)
			end
		end
	end
	if clickToDelete and not UIS:GetFocusedTextBox() then
		deleteTargetUnderMouse()
	end
end)

-- PASO 2: CLICK DERECHO PARA DUPLICAR EL OBJETO GUARDADO
UIS.InputBegan:Connect(function(input, gpe)
	if gpe then return end
	if input.UserInputType == Enum.UserInputType.MouseButton2 and copiedObject then
		local clone = smartClone(copiedObject)

		if clone then
			clone.Parent = workspace
			local targetPos = Mouse.Hit and Mouse.Hit.Position or (workspace.CurrentCamera.CFrame.Position + workspace.CurrentCamera.CFrame.LookVector * 15)

			pcall(function()
				if clone:IsA("BasePart") then
					clone.CFrame = CFrame.new(targetPos + Vector3.new(0, clone.Size.Y / 2, 0))
				elseif clone:IsA("Model") then
					local _, bSize = clone:GetBoundingBox()
					clone:PivotTo(CFrame.new(targetPos + Vector3.new(0, bSize.Y / 2, 0)))
				elseif clone:IsA("Tool") then
					local handle = clone:FindFirstChild("Handle") or clone:FindFirstChildOfClass("BasePart")
					if handle then
						handle.CFrame = CFrame.new(targetPos)
					end
				end
			end)
			notify("✨ Objeto '" .. clone.Name .. "' colocado con Clic Derecho!", THEME.success, 2)
		else
			notify("Error: No se pudo clonar el objeto seleccionado.", THEME.danger, 2.5)
			copiedObject = nil
			copyHighlight.Enabled = false
		end
	end
end)

-- TOGGLE MENÚ
local function toggleMenu()
	if Main.Visible then
		Main.Visible = false
		Circle.Visible = true
	else
		Main.Visible = true
		Circle.Visible = false
	end
end
onTap(MinBtn, toggleMenu)
onTap(Circle, toggleMenu)
onTap(CloseBtn, function()
	pcall(function()
		setFEInvisibility(false)
		setFirstPerson(false)
		RunService:UnbindFromRenderStep("GS_AimbotV54")
		if freecamOn then toggleFreecam(false) end
		if flying then stopFly() end
		if infiltratorConn then infiltratorConn:Disconnect() end
		copyHighlight:Destroy()
	end)
	SG:Destroy()
end)

-- INPUT
UIS.InputBegan:Connect(function(i, gpe)
	if gpe then return end
	local function tween(obj, props, time, style, dir)
		if not obj then return end
		local t = TweenService:Create(obj, TweenInfo.new(time or 0.2, style or Enum.EasingStyle.Quad, dir or Enum.EasingDirection.Out), props)
		t:Play()
		return t
	end
	if waitingForMenuKey then
		menuKey = i.KeyCode
		menuKeyName = i.KeyCode.Name
		waitingForMenuKey = false
		if keybindButtons["_MENU_"] then
			keybindButtons["_MENU_"].update()
			tween(keybindButtons["_MENU_"].btn, {BackgroundColor3 = THEME.accent}, 0.2)
		end
		notify("Tecla del menú: " .. menuKeyName, THEME.success, 2)
		return
	end
	if waitingForHackKey then
		local name = waitingForHackKey
		if hackKeybinds[name] then
			hackKeybinds[name].key = i.KeyCode
			hackKeybinds[name].keyName = i.KeyCode.Name
		end
		waitingForHackKey = nil
		if keybindButtons[name] then
			keybindButtons[name].update()
			tween(keybindButtons[name].btn, {BackgroundColor3 = THEME.accent}, 0.2)
		end
		notify("Atajo asignado: " .. i.KeyCode.Name, THEME.success, 2)
		return
	end
	if i.KeyCode == menuKey then toggleMenu() end
	for _, bind in pairs(hackKeybinds) do
		if bind.key ~= NONE_KEY and i.KeyCode == bind.key then
			bind.toggleFunc()
		end
	end
	if i.KeyCode == Enum.KeyCode.Space and infJump then doJump() end
	if i.KeyCode == Enum.KeyCode.W then keys.W = 1 end
	if i.KeyCode == Enum.KeyCode.S then keys.S = 1 end
	if i.KeyCode == Enum.KeyCode.A then keys.A = 1 end
	if i.KeyCode == Enum.KeyCode.D then keys.D = 1 end
	if i.KeyCode == Enum.KeyCode.Space then keys.Up = 1 end
	if i.KeyCode == Enum.KeyCode.LeftShift then keys.Down = 1 end
end)

UIS.InputEnded:Connect(function(i)
	if i.KeyCode == Enum.KeyCode.W then keys.W = 0 end
	if i.KeyCode == Enum.KeyCode.S then keys.S = 0 end
	if i.KeyCode == Enum.KeyCode.A then keys.A = 0 end
	if i.KeyCode == Enum.KeyCode.D then keys.D = 0 end
	if i.KeyCode == Enum.KeyCode.Space then keys.Up = 0 end
	if i.KeyCode == Enum.KeyCode.LeftShift then keys.Down = 0 end
end)

-- MANTENEDORES
task.spawn(function()
	while true do
		if firstPersonLock then
			pcall(function()
				LP.CameraMode = Enum.CameraMode.LockFirstPerson
				LP.CameraMinZoomDistance = 0.5
				LP.CameraMaxZoomDistance = 0.5
			end)
		end
		task.wait(0.2)
	end
end)

task.spawn(function()
	while true do
		if unlockMouse then
			pcall(function()
				UIS.MouseBehavior = Enum.MouseBehavior.Default
				UIS.MouseIconEnabled = true
			end)
		end
		task.wait(0.1)
	end
end)

task.spawn(function()
	while true do
		if unlock3rdPerson and not firstPersonLock then
			pcall(function()
				LP.CameraMode = Enum.CameraMode.Classic
				LP.CameraMinZoomDistance = 0.5
				LP.CameraMaxZoomDistance = 200
			end)
		end
		task.wait(0.5)
	end
end)

task.spawn(function()
	while true do
		if autoClicker and Character then
			pcall(function()
				for _, tool in ipairs(Character:GetChildren()) do
					if tool:IsA("Tool") then tool:Activate() end
				end
			end)
			task.wait(1 / autoClickCPS)
		else
			task.wait(0.1)
		end
	end
end)

-- MÓVIL
if isMobile then
	local MP = Instance.new("Frame")
	MP.Size = UDim2.new(0, 115, 0, 215)
	MP.Position = UDim2.new(1, -125, 0.5, -105)
	MP.BackgroundColor3 = THEME.bg
	MP.BackgroundTransparency = 0.2
	MP.Parent = SG
	Instance.new("UICorner", MP).CornerRadius = UDim.new(0, 10)
	local ml = Instance.new("UIListLayout", MP)
	ml.Padding = UDim.new(0, 4)
	ml.HorizontalAlignment = Enum.HorizontalAlignment.Center
	local mpPad = Instance.new("UIPadding", MP)
	mpPad.PaddingTop = UDim.new(0, 6)

	local function mBtn(text, col, cb)
		local b = Instance.new("TextButton")
		b.Size = UDim2.new(1, -10, 0, 30)
		b.BackgroundColor3 = col
		b.Text = text
		b.TextColor3 = Color3.fromRGB(255, 255, 255)
		b.Font = Enum.Font.GothamBold
		b.TextSize = 10
		b.Parent = MP
		Instance.new("UICorner", b).CornerRadius = UDim.new(0, 6)
		onTap(b, cb)
	end
	mBtn("🚀 SÚPER", THEME.warning, doSuperJump)
	mBtn("🦘 SALTO", THEME.success, doJump)
	mBtn("NOCLIP", THEME.accent2, function() noclipping = not noclipping end)
	mBtn("VOLAR", THEME.accent, function() if flying then stopFly() else startFly() end end)
	mBtn("MENÚ", Color3.fromRGB(50, 50, 70), toggleMenu)
end

-- ==============================================================================
-- 🚀 BUCLE PRINCIPAL (RENDER STEPPED)
-- ==============================================================================
RunService.RenderStepped:Connect(function()
	pcall(function()
		local Cam = workspace.CurrentCamera
		
		-- 👑 MOTOR DE PEGADO A LA CABEZA INFINITO (STICKY HEAD)
		if stickyHead and trollTargetPlayer and RootPart then
			local tChar = getPlayerCharacter(trollTargetPlayer)
			local tHead = tChar and (tChar:FindFirstChild("Head") or tChar:FindFirstChild("HumanoidRootPart"))
			if tHead and Character then
				noclipping = true
				for _, p in ipairs(Character:GetDescendants()) do
					if p:IsA("BasePart") then p.CanCollide = false end
				end
				RootPart.CFrame = tHead.CFrame * CFrame.new(0, stickyOffset, 0)
				RootPart.AssemblyLinearVelocity = Vector3.new(0, 0, 0)
				RootPart.AssemblyAngularVelocity = Vector3.new(0, 0, 0)
			end
		end

		if noclipping and Character then
			for _, p in ipairs(Character:GetDescendants()) do
				if p:IsA("BasePart") then p.CanCollide = false end
			end
		end
		if bhop and Humanoid and Humanoid.FloorMaterial ~= Enum.Material.Air then doJump() end
		if airWalk and RootPart then
			if not airWalkPart or not airWalkPart.Parent then
				airWalkPart = Instance.new("Part")
				airWalkPart.Size = Vector3.new(6, 1, 6)
				airWalkPart.Transparency = 0.8
				airWalkPart.Anchored = true
				airWalkPart.CanCollide = true
				airWalkPart.Color = THEME.accent
				airWalkPart.Parent = workspace
			end
			airWalkPart.CFrame = CFrame.new(RootPart.Position.X, RootPart.Position.Y - 3.5, RootPart.Position.Z)
		end
		if antiVoid and RootPart then
			if RootPart.Position.Y > -20 then
				lastSafeCFrame = RootPart.CFrame
			elseif RootPart.Position.Y < -60 then
				RootPart.AssemblyLinearVelocity = Vector3.new(0, 0, 0)
				RootPart.CFrame = lastSafeCFrame or realSpawnCFrame
				notify("🛡️ Rescatado", THEME.warning, 1)
			end
		end
		if spinBot and RootPart then
			RootPart.CFrame = RootPart.CFrame * CFrame.Angles(0, math.rad(spinSpeed), 0)
		end
		if hitboxOn then
			for _, plr in ipairs(Players:GetPlayers()) do
				if plr ~= LP and plr.Character then
					local hrp = plr.Character:FindFirstChild("HumanoidRootPart")
					if hrp then
						if not hitboxOriginals[hrp] then hitboxOriginals[hrp] = hrp.Size end
						hrp.Size = Vector3.new(hitboxSize, hitboxSize, hitboxSize)
						hrp.Transparency = 0.7
						hrp.CanCollide = false
					end
				end
			end
		end
		if killAura and Character and RootPart then
			for _, plr in ipairs(Players:GetPlayers()) do
				if plr ~= LP and plr.Character then
					local hrp = plr.Character:FindFirstChild("HumanoidRootPart")
					local hum = plr.Character:FindFirstChildOfClass("Humanoid")
					if hrp and hum and hum.Health > 0 and (hrp.Position - RootPart.Position).Magnitude <= killAuraRange then
						for _, tool in ipairs(Character:GetChildren()) do
							if tool:IsA("Tool") then tool:Activate() end
						end
					end
				end
			end
		end
		if triggerbot and Cam and Character then
			local ray = Cam:ViewportPointToRay(Cam.ViewportSize.X / 2, Cam.ViewportSize.Y / 2)
			local params = RaycastParams.new()
			params.FilterDescendantsInstances = {Character}
			params.FilterType = Enum.RaycastFilterType.Exclude
			local res = workspace:Raycast(ray.Origin, ray.Direction * 1000, params)
			if res and res.Instance and res.Instance.Parent:FindFirstChildOfClass("Humanoid") then
				for _, tool in ipairs(Character:GetChildren()) do
					if tool:IsA("Tool") then tool:Activate() end
				end
			end
		end
		if espOn then
			for _, plr in ipairs(Players:GetPlayers()) do
				if plr ~= LP and plr.Character and not plr.Character:FindFirstChild("GS_HL") then
					local h = Instance.new("Highlight")
					h.Name = "GS_HL"
					h.FillColor = THEME.danger
					h.OutlineColor = Color3.fromRGB(255, 255, 255)
					h.FillTransparency = 0.5
					h.Parent = plr.Character
				end
			end
		end
		if espNames and RootPart then
			for _, plr in ipairs(Players:GetPlayers()) do
				if plr ~= LP and plr.Character and plr.Character:FindFirstChild("Head") then
					local head = plr.Character.Head
					local tag = head:FindFirstChild("GS_TAG")
					if not tag then
						tag = Instance.new("BillboardGui")
						tag.Name = "GS_TAG"
						tag.Size = UDim2.new(0, 140, 0, 30)
						tag.StudsOffset = Vector3.new(0, 2.2, 0)
						tag.AlwaysOnTop = true
						local tl = Instance.new("TextLabel", tag)
						tl.Name = "Lbl"
						tl.Size = UDim2.new(1, 0, 1, 0)
						tl.BackgroundTransparency = 1
						tl.TextColor3 = Color3.fromRGB(255, 255, 255)
						tl.Font = Enum.Font.GothamBold
						tl.TextSize = 11
						tag.Parent = head
					end
					tag.Lbl.Text = plr.DisplayName .. "\n[" .. math.floor((head.Position - RootPart.Position).Magnitude) .. "m]"
				end
			end
		end
		if flying and flyBV and flyBG and Cam then
			local cf = Cam.CFrame
			local dir = (cf.LookVector * (keys.W - keys.S)) + (cf.RightVector * (keys.D - keys.A)) + Vector3.new(0, keys.Up - keys.Down, 0)
			flyBV.Velocity = dir.Magnitude > 0 and dir.Unit * flySpeed or Vector3.new(0, 0, 0)
			flyBG.CFrame = cf
		end
		if speeding and Humanoid then Humanoid.WalkSpeed = runSpeed end
		if godMode and Humanoid then Humanoid.Health = Humanoid.MaxHealth end
	end)
end)

notify("🧹 GS v54 - Sistema Limpiador de Clones Cargado!", THEME.success, 3.5)

Features & Information

Noclip, fly, eso etc

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts