Aimbot universal
Key RequiredUniversal

Aimbot universal

Universal ScriptAnthony6393Anthony6393 1.9K views 37.1K executesUpdated Aug 18, 2026
Unrated
00
Lua Script•1160 lines (24886 chars)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local Workspace = game:GetService("Workspace")

local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
local Camera = Workspace.CurrentCamera

local Config = {
	ESP = false,
	AimAssist = false,
	TargetLock = false,
	WallCheck = true,
	HitboxDebug = false,
	IgnoreFriends = false,
	AimSmoothness = 0.18,
	MaxDistance = 500,
	TargetPart = "Head",
	Theme = "Dark"
}

local State = {
	Target = nil,
	ESP = {},
	Hitboxes = {},
	GUIOpen = true
}

local Themes = {
	Dark = {
		Background = Color3.fromRGB(17,17,22),
		Panel = Color3.fromRGB(27,27,34),
		Button = Color3.fromRGB(39,39,49),
		Accent = Color3.fromRGB(0,200,255),
		Text = Color3.fromRGB(245,245,250),
		SubText = Color3.fromRGB(155,155,170)
	},

	Emerald = {
		Background = Color3.fromRGB(10,22,18),
		Panel = Color3.fromRGB(17,36,28),
		Button = Color3.fromRGB(26,51,41),
		Accent = Color3.fromRGB(0,220,140),
		Text = Color3.fromRGB(235,255,245),
		SubText = Color3.fromRGB(145,180,165)
	}
}

local Theme = Themes.Dark

local function Create(Class, Properties, Parent)
	local Object = Instance.new(Class)

	for Property, Value in pairs(Properties) do
		Object[Property] = Value
	end

	Object.Parent = Parent
	return Object
end

local function Corner(Object, Radius)
	local C = Instance.new("UICorner")
	C.CornerRadius = UDim.new(0, Radius)
	C.Parent = Object
	return C
end

local ScreenGui = Create("ScreenGui", {
	Name = "SonicHub",
	ResetOnSpawn = false,
	IgnoreGuiInset = true,
	ZIndexBehavior = Enum.ZIndexBehavior.Sibling
}, PlayerGui)

local Icon = Create("TextButton", {
	Name = "EXE",
	Size = UDim2.fromOffset(60,60),
	Position = UDim2.new(0,20,0.5,-30),
	BackgroundColor3 = Theme.Panel,
	BorderSizePixel = 0,
	Text = "EXE",
	TextColor3 = Theme.Accent,
	TextSize = 15,
	Font = Enum.Font.GothamBold,
	AutoButtonColor = false
}, ScreenGui)

Corner(Icon,30)

local IconStroke = Instance.new("UIStroke")
IconStroke.Name = "EXE_Stroke"
IconStroke.Color = Theme.Accent
IconStroke.Thickness = 2
IconStroke.Parent = Icon

local Main = Create("Frame", {
	Name = "SonicHub",
	Size = UDim2.fromOffset(430,435),
	Position = UDim2.new(0.5,-215,0.5,-217),
	BackgroundColor3 = Theme.Background,
	BorderSizePixel = 0
}, ScreenGui)

Corner(Main,14)

local MainStroke = Instance.new("UIStroke")
MainStroke.Color = Theme.Accent
MainStroke.Transparency = 0.5
MainStroke.Parent = Main

local TopBar = Create("Frame", {
	Size = UDim2.new(1,0,0,58),
	BackgroundColor3 = Theme.Panel,
	BorderSizePixel = 0
}, Main)

Corner(TopBar,14)

local Title = Create("TextLabel", {
	BackgroundTransparency = 1,
	Position = UDim2.fromOffset(18,7),
	Size = UDim2.new(1,-80,0,25),
	Text = "SONIC HUB",
	TextColor3 = Theme.Text,
	Font = Enum.Font.GothamBold,
	TextSize = 18,
	TextXAlignment = Enum.TextXAlignment.Left
}, TopBar)

local Subtitle = Create("TextLabel", {
	BackgroundTransparency = 1,
	Position = UDim2.fromOffset(19,32),
	Size = UDim2.new(1,-80,0,18),
	Text = "EXE • Studio Debug System",
	TextColor3 = Theme.SubText,
	Font = Enum.Font.Gotham,
	TextSize = 11,
	TextXAlignment = Enum.TextXAlignment.Left
}, TopBar)

local Close = Create("TextButton", {
	Size = UDim2.fromOffset(34,34),
	Position = UDim2.new(1,-44,0,12),
	BackgroundColor3 = Theme.Button,
	BorderSizePixel = 0,
	Text = "×",
	TextColor3 = Theme.Text,
	TextSize = 20,
	Font = Enum.Font.GothamBold
}, TopBar)

Corner(Close,8)

local Content = Create("ScrollingFrame", {
	Position = UDim2.fromOffset(15,70),
	Size = UDim2.new(1,-30,1,-85),
	BackgroundTransparency = 1,
	BorderSizePixel = 0,
	ScrollBarThickness = 3,
	CanvasSize = UDim2.new(0,0,0,0),
	AutomaticCanvasSize = Enum.AutomaticSize.Y
}, Main)

Create("UIListLayout", {
	Padding = UDim.new(0,8),
	SortOrder = Enum.SortOrder.LayoutOrder
}, Content)

local Dragging = false
local DragStart
local StartPosition

TopBar.InputBegan:Connect(function(Input)
	if Input.UserInputType == Enum.UserInputType.MouseButton1
		or Input.UserInputType == Enum.UserInputType.Touch then
		Dragging = true
		DragStart = Input.Position
		StartPosition = Main.Position
	end
end)

TopBar.InputEnded:Connect(function(Input)
	if Input.UserInputType == Enum.UserInputType.MouseButton1
		or Input.UserInputType == Enum.UserInputType.Touch then
		Dragging = false
	end
end)

UserInputService.InputChanged:Connect(function(Input)
	if not Dragging then
		return
	end

	if Input.UserInputType ~= Enum.UserInputType.MouseMovement
		and Input.UserInputType ~= Enum.UserInputType.Touch then
		return
	end

	local Delta = Input.Position - DragStart

	Main.Position = UDim2.new(
		StartPosition.X.Scale,
		StartPosition.X.Offset + Delta.X,
		StartPosition.Y.Scale,
		StartPosition.Y.Offset + Delta.Y
	)
end)

local function OpenGUI()
	State.GUIOpen = true
	Main.Visible = true
	Main.Size = UDim2.fromOffset(0,0)

	TweenService:Create(
		Main,
		TweenInfo.new(0.25,Enum.EasingStyle.Back,Enum.EasingDirection.Out),
		{Size = UDim2.fromOffset(430,435)}
	):Play()
end

local function CloseGUI()
	State.GUIOpen = false

	local Tween = TweenService:Create(
		Main,
		TweenInfo.new(0.18,Enum.EasingStyle.Quad,Enum.EasingDirection.In),
		{Size = UDim2.fromOffset(0,0)}
	)

	Tween:Play()

	Tween.Completed:Once(function()
		if not State.GUIOpen then
			Main.Visible = false
		end
	end)
end

Icon.MouseButton1Click:Connect(function()
	if State.GUIOpen then
		CloseGUI()
	else
		OpenGUI()
	end
end)

Close.MouseButton1Click:Connect(CloseGUI)

local IconDragging = false
local IconStart
local IconPosition

Icon.InputBegan:Connect(function(Input)
	if Input.UserInputType == Enum.UserInputType.MouseButton1
		or Input.UserInputType == Enum.UserInputType.Touch then
		IconDragging = true
		IconStart = Input.Position
		IconPosition = Icon.Position
	end
end)

Icon.InputEnded:Connect(function(Input)
	if Input.UserInputType == Enum.UserInputType.MouseButton1
		or Input.UserInputType == Enum.UserInputType.Touch then
		IconDragging = false
	end
end)

UserInputService.InputChanged:Connect(function(Input)
	if not IconDragging then
		return
	end

	if Input.UserInputType ~= Enum.UserInputType.MouseMovement
		and Input.UserInputType ~= Enum.UserInputType.Touch then
		return
	end

	local Delta = Input.Position - IconStart

	Icon.Position = UDim2.new(
		IconPosition.X.Scale,
		IconPosition.X.Offset + Delta.X,
		IconPosition.Y.Scale,
		IconPosition.Y.Offset + Delta.Y
	)
end)

local function CreateToggle(Name, Default, Callback)
	local Button = Create("TextButton", {
		Size = UDim2.new(1,0,0,42),
		BackgroundColor3 = Theme.Button,
		BorderSizePixel = 0,
		TextColor3 = Theme.Text,
		TextSize = 13,
		Font = Enum.Font.GothamMedium,
		AutoButtonColor = false
	}, Content)

	Corner(Button,8)

	local Enabled = Default

	local function Refresh()
		Button.Text = Name .. (Enabled and "  •  ON" or "  •  OFF")

		if Enabled then
			Button.BackgroundColor3 = Theme.Accent
			Button.TextColor3 = Color3.fromRGB(0,0,0)
		else
			Button.BackgroundColor3 = Theme.Button
			Button.TextColor3 = Theme.Text
		end
	end

	Button.MouseButton1Click:Connect(function()
		Enabled = not Enabled
		Callback(Enabled)
		Refresh()
	end)

	Refresh()

	return Button
end

local function IsValidTarget(Player)
	if not Player or Player == LocalPlayer then
		return false
	end

	if Config.IgnoreFriends then
		local Success, IsFriend = pcall(function()
			return LocalPlayer:IsFriendsWith(Player.UserId)
		end)

		if Success and IsFriend then
			return false
		end
	end

	local Character = Player.Character
	if not Character then
		return false
	end

	local Humanoid = Character:FindFirstChildOfClass("Humanoid")
	local Root = Character:FindFirstChild("HumanoidRootPart")

	if not Humanoid or Humanoid.Health <= 0 or not Root then
		return false
	end

	return true
end

local function GetDistance(Player)
	if not IsValidTarget(Player) then
		return math.huge
	end

	local Character = LocalPlayer.Character
	if not Character then
		return math.huge
	end

	local MyRoot = Character:FindFirstChild("HumanoidRootPart")
	local TargetRoot = Player.Character:FindFirstChild("HumanoidRootPart")

	if not MyRoot or not TargetRoot then
		return math.huge
	end

	return (MyRoot.Position - TargetRoot.Position).Magnitude
end

local function HasLineOfSight(Target)
	if not IsValidTarget(Target) then
		return false
	end

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

	local OriginPart =
		Character:FindFirstChild("Head")
		or Character:FindFirstChild("HumanoidRootPart")

	local TargetPart =
		Target.Character:FindFirstChild(Config.TargetPart)
		or Target.Character:FindFirstChild("HumanoidRootPart")

	if not OriginPart or not TargetPart then
		return false
	end

	local Parameters = RaycastParams.new()

	Parameters.FilterType = Enum.RaycastFilterType.Exclude
	Parameters.FilterDescendantsInstances = {Character}
	Parameters.IgnoreWater = true

	local Result = Workspace:Raycast(
		OriginPart.Position,
		TargetPart.Position - OriginPart.Position,
		Parameters
	)

	if not Result then
		return true
	end

	return Result.Instance:IsDescendantOf(Target.Character)
end

local function FindTarget()
	local BestTarget = nil
	local BestDistance = Config.MaxDistance

	for _, Player in ipairs(Players:GetPlayers()) do
		if IsValidTarget(Player) then
			local Distance = GetDistance(Player)

			if Distance <= BestDistance then
				local Visible = true

				if Config.WallCheck then
					Visible = HasLineOfSight(Player)
				end

				if Visible then
					BestDistance = Distance
					BestTarget = Player
				end
			end
		end
	end

	return BestTarget
end

local function CreateESP(Player)
	if State.ESP[Player] then
		return
	end

	if not IsValidTarget(Player) then
		return
	end

	local Character = Player.Character

	local Highlight = Instance.new("Highlight")
	Highlight.Name = "SonicHubESP"
	Highlight.Adornee = Character
	Highlight.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
	Highlight.FillTransparency = 0.75
	Highlight.OutlineTransparency = 0
	Highlight.FillColor = Theme.Accent
	Highlight.OutlineColor = Theme.Text
	Highlight.Parent = Character

	local Billboard = Instance.new("BillboardGui")
	Billboard.Name = "SonicHubTargetName"
	Billboard.Adornee = Character:FindFirstChild("Head")
	Billboard.Size = UDim2.fromOffset(180,30)
	Billboard.StudsOffset = Vector3.new(0,3,0)
	Billboard.AlwaysOnTop = true
	Billboard.Parent = Character

	local Label = Instance.new("TextLabel")
	Label.BackgroundTransparency = 1
	Label.Size = UDim2.fromScale(1,1)
	Label.Text = Player.DisplayName
	Label.Font = Enum.Font.GothamBold
	Label.TextSize = 13
	Label.TextColor3 = Theme.Accent
	Label.TextStrokeTransparency = 0.5
	Label.Parent = Billboard

	State.ESP[Player] = {
		Highlight = Highlight,
		Billboard = Billboard
	}
end

local function RemoveESP(Player)
	local Data = State.ESP[Player]

	if not Data then
		return
	end

	if Data.Highlight then
		Data.Highlight:Destroy()
	end

	if Data.Billboard then
		Data.Billboard:Destroy()
	end

	State.ESP[Player] = nil
end

local function UpdateESP()
	for _, Player in ipairs(Players:GetPlayers()) do
		if Player ~= LocalPlayer then
			if Config.ESP then
				CreateESP(Player)
			else
				RemoveESP(Player)
			end
		end
	end
end

local function CreateHitbox(Player)
	if State.Hitboxes[Player] then
		return
	end

	if not IsValidTarget(Player) then
		return
	end

	local Root = Player.Character:FindFirstChild("HumanoidRootPart")

	if not Root then
		return
	end

	local Selection = Instance.new("SelectionBox")
	Selection.Name = "SonicHubHitboxDebug"
	Selection.Adornee = Root
	Selection.LineThickness = 0.05
	Selection.Color3 = Theme.Accent
	Selection.Parent = Root

	State.Hitboxes[Player] = Selection
end

local function RemoveHitbox(Player)
	if State.Hitboxes[Player] then
		State.Hitboxes[Player]:Destroy()
		State.Hitboxes[Player] = nil
	end
end

local function UpdateHitboxes()
	for _, Player in ipairs(Players:GetPlayers()) do
		if Player ~= LocalPlayer then
			if Config.HitboxDebug then
				CreateHitbox(Player)
			else
				RemoveHitbox(Player)
			end
		end
	end
end

local function AimAtTarget(Target)
	if not Target then
		return
	end

	if not IsValidTarget(Target) then
		return
	end

	if Config.WallCheck and not HasLineOfSight(Target) then
		return
	end

	local Part = Target.Character:FindFirstChild(Config.TargetPart)

	if not Part then
		return
	end

	local Desired = CFrame.lookAt(
		Camera.CFrame.Position,
		Part.Position
	)

	Camera.CFrame = Camera.CFrame:Lerp(
		Desired,
		Config.AimSmoothness
	)
end

CreateToggle("ESP",false,function(Value)
	Config.ESP = Value

	if not Value then
		for Player in pairs(State.ESP) do
			RemoveESP(Player)
		end
	end
end)

CreateToggle("Aim Assist",false,function(Value)
	Config.AimAssist = Value
end)

CreateToggle("Target Lock",false,function(Value)
	Config.TargetLock = Value

	if Value then
		State.Target = FindTarget()
	else
		State.Target = nil
	end
end)

CreateToggle("Wall Check",true,function(Value)
	Config.WallCheck = Value
end)

CreateToggle("Ignore Friends",false,function(Value)
	Config.IgnoreFriends = Value

	if Value and State.Target then
		if not IsValidTarget(State.Target) then
			State.Target = nil
		end
	end
end)

CreateToggle("Hitbox Debug",false,function(Value)
	Config.HitboxDebug = Value
	UpdateHitboxes()
end)

local SliderFrame = Create("Frame", {
	Size = UDim2.new(1,0,0,58),
	BackgroundColor3 = Theme.Button,
	BorderSizePixel = 0
}, Content)

Corner(SliderFrame,8)

local SliderLabel = Create("TextLabel", {
	BackgroundTransparency = 1,
	Position = UDim2.fromOffset(12,5),
	Size = UDim2.new(1,-24,0,20),
	Text = "Aim Smoothness: 18%",
	TextColor3 = Theme.Text,
	Font = Enum.Font.GothamMedium,
	TextSize = 12,
	TextXAlignment = Enum.TextXAlignment.Left
}, SliderFrame)

local Slider = Create("TextButton", {
	Position = UDim2.fromOffset(12,34),
	Size = UDim2.new(1,-24,0,8),
	BackgroundColor3 = Theme.Panel,
	BorderSizePixel = 0,
	Text = ""
}, SliderFrame)

Corner(Slider,5)

local Fill = Create("Frame", {
	Size = UDim2.new(Config.AimSmoothness,0,1,0),
	BackgroundColor3 = Theme.Accent,
	BorderSizePixel = 0
}, Slider)

Corner(Fill,5)

local Sliding = false

local function UpdateSlider(X)
	local Start = Slider.AbsolutePosition.X
	local Width = Slider.AbsoluteSize.X

	local Value = math.clamp(
		(X - Start) / Width,
		0,
		1
	)

	Config.AimSmoothness = math.max(Value,0.01)

	Fill.Size = UDim2.new(
		Config.AimSmoothness,
		0,
		1,
		0
	)

	SliderLabel.Text =
		"Aim Smoothness: "
		.. math.floor(Config.AimSmoothness * 100)
		.. "%"
end

Slider.InputBegan:Connect(function(Input)
	if Input.UserInputType == Enum.UserInputType.MouseButton1
		or Input.UserInputType == Enum.UserInputType.Touch then

		Sliding = true
		UpdateSlider(Input.Position.X)
	end
end)

UserInputService.InputChanged:Connect(function(Input)
	if not Sliding then
		return
	end

	if Input.UserInputType == Enum.UserInputType.MouseMovement
		or Input.UserInputType == Enum.UserInputType.Touch then

		UpdateSlider(Input.Position.X)
	end
end)

UserInputService.InputEnded:Connect(function(Input)
	if Input.UserInputType == Enum.UserInputType.MouseButton1
		or Input.UserInputType == Enum.UserInputType.Touch then

		Sliding = false
	end
end)

local ThemeButton = Create("TextButton", {
	Size = UDim2.new(1,0,0,42),
	BackgroundColor3 = Theme.Button,
	BorderSizePixel = 0,
	Text = "THEME : DARK",
	TextColor3 = Theme.Text,
	Font = Enum.Font.GothamMedium,
	TextSize = 13
}, Content)

Corner(ThemeButton,8)

local function ApplyTheme(Name)
	Theme = Themes[Name]

	Main.BackgroundColor3 = Theme.Background
	TopBar.BackgroundColor3 = Theme.Panel

	Title.TextColor3 = Theme.Text
	Subtitle.TextColor3 = Theme.SubText

	Close.BackgroundColor3 = Theme.Button
	Close.TextColor3 = Theme.Text

	Icon.BackgroundColor3 = Theme.Panel
	Icon.TextColor3 = Theme.Accent
	IconStroke.Color = Theme.Accent
	MainStroke.Color = Theme.Accent

	SliderFrame.BackgroundColor3 = Theme.Button
	Slider.BackgroundColor3 = Theme.Panel
	Fill.BackgroundColor3 = Theme.Accent

	ThemeButton.BackgroundColor3 = Theme.Button
	ThemeButton.TextColor3 = Theme.Text

	for _, Object in ipairs(Content:GetChildren()) do
		if Object:IsA("TextButton")
			and Object ~= Slider
			and Object ~= ThemeButton then

			Object.BackgroundColor3 = Theme.Button
			Object.TextColor3 = Theme.Text
		end
	end

	for _, Data in pairs(State.ESP) do
		if Data.Highlight then
			Data.Highlight.FillColor = Theme.Accent
			Data.Highlight.OutlineColor = Theme.Text
		end

		if Data.Billboard then
			local Label =
				Data.Billboard:FindFirstChildOfClass("TextLabel")

			if Label then
				Label.TextColor3 = Theme.Accent
			end
		end
	end
end

ThemeButton.MouseButton1Click:Connect(function()
	if Config.Theme == "Dark" then
		Config.Theme = "Emerald"
		ThemeButton.Text = "THEME : EMERALD"
		ApplyTheme("Emerald")
	else
		Config.Theme = "Dark"
		ThemeButton.Text = "THEME : DARK"
		ApplyTheme("Dark")
	end
end)

local function UpdateTarget()
	if Config.TargetLock then
		if not IsValidTarget(State.Target) then
			State.Target = FindTarget()
		end
	else
		State.Target = FindTarget()
	end
end

RunService.RenderStepped:Connect(function()
	UpdateESP()
	UpdateHitboxes()
	UpdateTarget()

	if Config.AimAssist then
		AimAtTarget(State.Target)
	end
end)

Players.PlayerRemoving:Connect(function(Player)
	RemoveESP(Player)
	RemoveHitbox(Player)

	if State.Target == Player then
		State.Target = nil
	end
end)

Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function()
		task.wait(1)

		if Config.ESP then
			CreateESP(Player)
		end

		if Config.HitboxDebug then
			CreateHitbox(Player)
		end
	end)
end)
-- REEMPLAZA LAS FUNCIONES DE ESP DEL SCRIPT ANTERIOR POR ESTE ESP MEJORADO

local ESPFolder = Instance.new("Folder")
ESPFolder.Name = "SonicHubESP"
ESPFolder.Parent = ScreenGui

local function RemoveESP(Player)
	local Data = State.ESP[Player]

	if Data then
		for _, Object in pairs(Data) do
			if typeof(Object) == "Instance" then
				Object:Destroy()
			end
		end
	end

	State.ESP[Player] = nil
end

local function CreateESP(Player)
	if Player == LocalPlayer then
		return
	end

	if not IsValidTarget(Player) then
		return
	end

	if State.ESP[Player] then
		return
	end

	local Character = Player.Character
	local Humanoid = Character:FindFirstChildOfClass("Humanoid")
	local Root = Character:FindFirstChild("HumanoidRootPart")
	local Head = Character:FindFirstChild("Head")

	if not Character or not Humanoid or not Root or not Head then
		return
	end

	local Data = {}

	-- Highlight
	local Highlight = Instance.new("Highlight")
	Highlight.Name = "SonicESPHighlight"
	Highlight.Adornee = Character
	Highlight.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
	Highlight.FillColor = Color3.fromRGB(255,0,0)
	Highlight.OutlineColor = Color3.fromRGB(255,255,255)
	Highlight.FillTransparency = 0.82
	Highlight.OutlineTransparency = 0
	Highlight.Parent = ESPFolder

	Data.Highlight = Highlight

	-- Información sobre la cabeza
	local Billboard = Instance.new("BillboardGui")
	Billboard.Name = "SonicESPInfo"
	Billboard.Adornee = Head
	Billboard.Size = UDim2.fromOffset(190,75)
	Billboard.StudsOffset = Vector3.new(0,3.2,0)
	Billboard.AlwaysOnTop = true
	Billboard.MaxDistance = Config.MaxDistance
	Billboard.Parent = ESPFolder

	Data.Billboard = Billboard

	local Name = Instance.new("TextLabel")
	Name.BackgroundTransparency = 1
	Name.Size = UDim2.new(1,0,0,24)
	Name.Text = Player.DisplayName
	Name.TextColor3 = Color3.fromRGB(255,0,0)
	Name.TextStrokeTransparency = 0
	Name.Font = Enum.Font.GothamBold
	Name.TextSize = 14
	Name.Parent = Billboard

	local Distance = Instance.new("TextLabel")
	Distance.BackgroundTransparency = 1
	Distance.Position = UDim2.fromOffset(0,22)
	Distance.Size = UDim2.new(1,0,0,20)
	Distance.TextColor3 = Color3.fromRGB(255,255,255)
	Distance.TextStrokeTransparency = 0
	Distance.Font = Enum.Font.Gotham
	Distance.TextSize = 11
	Distance.Parent = Billboard

	local Health = Instance.new("TextLabel")
	Health.BackgroundTransparency = 1
	Health.Position = UDim2.fromOffset(0,43)
	Health.Size = UDim2.new(1,0,0,20)
	Health.TextColor3 = Color3.fromRGB(80,255,80)
	Health.TextStrokeTransparency = 0
	Health.Font = Enum.Font.GothamBold
	Health.TextSize = 11
	Health.Parent = Billboard

	Data.Distance = Distance
	Data.Health = Health

	-- Caja 3D para representar el área del personaje
	local Box = Instance.new("BoxHandleAdornment")
	Box.Name = "SonicESPBox"
	Box.Adornee = Root
	Box.Size = Vector3.new(4,6,2)
	Box.Color3 = Color3.fromRGB(255,0,0)
	Box.Transparency = 0.65
	Box.AlwaysOnTop = true
	Box.ZIndex = 5
	Box.Parent = ESPFolder

	Data.Box = Box

	-- Tracer visual
	local Tracer = Instance.new("Frame")
	Tracer.Name = "Tracer"
	Tracer.AnchorPoint = Vector2.new(0.5,0.5)
	Tracer.BorderSizePixel = 0
	Tracer.BackgroundColor3 = Color3.fromRGB(255,0,0)
	Tracer.Visible = false
	Tracer.Parent = ESPFolder

	-- Punto central del tracer
	local Dot = Instance.new("Frame")
	Dot.Name = "TargetDot"
	Dot.AnchorPoint = Vector2.new(0.5,0.5)
	Dot.Size = UDim2.fromOffset(5,5)
	Dot.BackgroundColor3 = Color3.fromRGB(255,0,0)
	Dot.BorderSizePixel = 0
	Dot.Visible = false
	Dot.Parent = ESPFolder

	local DotCorner = Instance.new("UICorner")
	DotCorner.CornerRadius = UDim.new(1,0)
	DotCorner.Parent = Dot

	Data.Tracer = Tracer
	Data.Dot = Dot

	State.ESP[Player] = Data
end

local function UpdateESP(Player)
	local Data = State.ESP[Player]

	if not Data then
		CreateESP(Player)
		Data = State.ESP[Player]
	end

	if not Data then
		return
	end

	if not Config.ESP then
		for _, Object in pairs(Data) do
			if typeof(Object) == "Instance" then
				Object.Visible = false
			end
		end
		return
	end

	local Character = Player.Character
	local Humanoid = Character and Character:FindFirstChildOfClass("Humanoid")
	local Root = Character and Character:FindFirstChild("HumanoidRootPart")
	local Head = Character and Character:FindFirstChild("Head")

	if not Character or not Humanoid or not Root or not Head
		or Humanoid.Health <= 0 then

		RemoveESP(Player)
		return
	end

	local Distance = GetDistance(Player)

	if Distance > Config.MaxDistance then
		Data.Billboard.Enabled = false
		Data.Tracer.Visible = false
		Data.Dot.Visible = false
		Data.Highlight.Enabled = false
		Data.Box.Visible = false
		return
	end

	Data.Billboard.Enabled = true
	Data.Highlight.Enabled = true
	Data.Box.Visible = true

	-- Actualizar distancia
	Data.Distance.Text =
		"Distance: " .. math.floor(Distance) .. " studs"

	-- Actualizar vida
	local HealthPercent =
		math.clamp(
			Humanoid.Health / math.max(Humanoid.MaxHealth,1),
			0,
			1
		)

	Data.Health.Text =
		"HP: "
		.. math.floor(Humanoid.Health)
		.. " / "
		.. math.floor(Humanoid.MaxHealth)

	-- Cambiar color según vida
	if HealthPercent > 0.6 then
		Data.Health.TextColor3 = Color3.fromRGB(80,255,80)
	elseif HealthPercent > 0.3 then
		Data.Health.TextColor3 = Color3.fromRGB(255,200,50)
	else
		Data.Health.TextColor3 = Color3.fromRGB(255,50,50)
	end

	-- Actualizar tamaño de caja
	local Height = math.clamp(
		Character:GetExtentsSize().Y,
		4,
		8
	)

	Data.Box.Size = Vector3.new(4,Height,2)

	-- Tracer desde la parte inferior de la pantalla
	local ScreenPosition, OnScreen =
		Camera:WorldToViewportPoint(Root.Position)

	if OnScreen then
		local Start = Vector2.new(
			Camera.ViewportSize.X / 2,
			Camera.ViewportSize.Y
		)

		local End = Vector2.new(
			ScreenPosition.X,
			ScreenPosition.Y
		)

		local Difference = End - Start
		local Length = Difference.Magnitude

		Data.Tracer.Position = UDim2.fromOffset(
			(Start.X + End.X) / 2,
			(Start.Y + End.Y) / 2
		)

		Data.Tracer.Size = UDim2.fromOffset(
			2,
			Length
		)

		Data.Tracer.Rotation =
			math.deg(math.atan2(Difference.Y,Difference.X)) + 90

		Data.Tracer.Visible = true

		Data.Dot.Position = UDim2.fromOffset(
			ScreenPosition.X,
			ScreenPosition.Y
		)

		Data.Dot.Visible = true
	else
		Data.Tracer.Visible = false
		Data.Dot.Visible = false
	end

	-- Color rojo para todos los objetivos
	Data.Highlight.FillColor = Color3.fromRGB(255,0,0)
	Data.Highlight.OutlineColor = Color3.fromRGB(255,255,255)

	Data.Box.Color3 = Color3.fromRGB(255,0,0)
	Data.Tracer.BackgroundColor3 = Color3.fromRGB(255,0,0)
	Data.Dot.BackgroundColor3 = Color3.fromRGB(255,0,0)
end

local function UpdateAllESP()
	for _, Player in ipairs(Players:GetPlayers()) do
		if Player ~= LocalPlayer then
			if Config.ESP then
				UpdateESP(Player)
			elseif State.ESP[Player] then
				RemoveESP(Player)
			end
		end
	end
end

Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function()
		task.wait(0.5)

		if Config.ESP then
			CreateESP(Player)
		end
	end)
end)

Players.PlayerRemoving:Connect(function(Player)
	RemoveESP(Player)
end)

RunService.RenderStepped:Connect(function()
	if Config.ESP then
		UpdateAllESP()
	end
end)

Features & Information

Sonic hub

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts