--[[ ╔═══════════════════════════════════════════════════════════════╗ ║ DISTANCING BY MAXX ║ ║ Advanced AI Distance Keeping with Draggable GUI ║ ║ Supports PC (Mouse) & Mobile (Touch) ║ ╚═══════════════════════════════════════════════════════════════╝ --]] local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") local PathfindingService = game:GetService("PathfindingService") local TweenService = game:GetService("TweenService") local LocalPlayer = Players.LocalPlayer local PlayerGui = LocalPlayer:WaitForChild("PlayerGui") local CONFIG = { DETECTION_RADIUS = 20, FLEE_RADIUS = 8, MOVE_SPEED = 24, SMOOTHING_FACTOR = 0.15, ROTATION_SMOOTHING = 0.1, PATHFIND_TIMEOUT = 0.8, JUMP_COOLDOWN = 0.5, } local isEnabled = false local currentVelocity = Vector3.new(0, 0, 0) local targetVelocity = Vector3.new(0, 0, 0) local lastPathfindTime = 0 local lastJumpTime = 0 local currentWaypoints = {} local currentWaypointIndex = 1 local bodyVelocity = nil local bodyGyro = nil local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "DistancingGui" ScreenGui.ResetOnSpawn = false ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling ScreenGui.Parent = PlayerGui local MainFrame = Instance.new("Frame") MainFrame.Name = "MainFrame" MainFrame.Size = UDim2.new(0, 300, 0, 200) MainFrame.Position = UDim2.new(0.5, -150, 0, 60) MainFrame.BackgroundColor3 = Color3.fromRGB(15, 15, 30) MainFrame.BorderSizePixel = 0 MainFrame.Active = true MainFrame.Parent = ScreenGui local MainCorner = Instance.new("UICorner") MainCorner.CornerRadius = UDim.new(0, 20) MainCorner.Parent = MainFrame local DropShadow = Instance.new("ImageLabel") DropShadow.Name = "DropShadow" DropShadow.Size = UDim2.new(1, 40, 1, 40) DropShadow.Position = UDim2.new(0, -20, 0, -15) DropShadow.BackgroundTransparency = 1 DropShadow.Image = "rbxassetid://6015897843" DropShadow.ImageColor3 = Color3.fromRGB(0, 0, 0) DropShadow.ImageTransparency = 0.5 DropShadow.ScaleType = Enum.ScaleType.Slice DropShadow.SliceCenter = Rect.new(49, 49, 450, 450) DropShadow.ZIndex = -1 DropShadow.Parent = MainFrame local AnimatedBG = Instance.new("Frame") AnimatedBG.Name = "AnimatedBackground" AnimatedBG.Size = UDim2.new(1, 0, 1, 0) AnimatedBG.BackgroundColor3 = Color3.fromRGB(20, 20, 40) AnimatedBG.BorderSizePixel = 0 AnimatedBG.ClipsDescendants = true AnimatedBG.Parent = MainFrame local BGCorner = Instance.new("UICorner") BGCorner.CornerRadius = UDim.new(0, 20) BGCorner.Parent = AnimatedBG local GradientFrame = Instance.new("Frame") GradientFrame.Name = "GradientFrame" GradientFrame.Size = UDim2.new(2, 0, 2, 0) GradientFrame.Position = UDim2.new(-0.5, 0, -0.5, 0) GradientFrame.BackgroundTransparency = 0.3 GradientFrame.BorderSizePixel = 0 GradientFrame.Parent = AnimatedBG local MainGradient = Instance.new("UIGradient") MainGradient.Color = ColorSequence.new({ ColorSequenceKeypoint.new(0, Color3.fromRGB(100, 40, 150)), ColorSequenceKeypoint.new(0.3, Color3.fromRGB(40, 80, 160)), ColorSequenceKeypoint.new(0.6, Color3.fromRGB(150, 50, 100)), ColorSequenceKeypoint.new(1, Color3.fromRGB(60, 100, 180)) }) MainGradient.Rotation = 0 MainGradient.Parent = GradientFrame local GlowOrb = Instance.new("Frame") GlowOrb.Name = "GlowOrb" GlowOrb.Size = UDim2.new(0.4, 0, 0.6, 0) GlowOrb.Position = UDim2.new(0.3, 0, 0.2, 0) GlowOrb.BackgroundColor3 = Color3.fromRGB(150, 100, 255) GlowOrb.BackgroundTransparency = 0.7 GlowOrb.BorderSizePixel = 0 GlowOrb.Parent = AnimatedBG local GlowCorner = Instance.new("UICorner") GlowCorner.CornerRadius = UDim.new(1, 0) GlowCorner.Parent = GlowOrb local GlowOrb2 = Instance.new("Frame") GlowOrb2.Name = "GlowOrb2" GlowOrb2.Size = UDim2.new(0.3, 0, 0.5, 0) GlowOrb2.Position = UDim2.new(0.5, 0, 0.3, 0) GlowOrb2.BackgroundColor3 = Color3.fromRGB(100, 150, 255) GlowOrb2.BackgroundTransparency = 0.75 GlowOrb2.BorderSizePixel = 0 GlowOrb2.Parent = AnimatedBG local GlowCorner2 = Instance.new("UICorner") GlowCorner2.CornerRadius = UDim.new(1, 0) GlowCorner2.Parent = GlowOrb2 local ContentFrame = Instance.new("Frame") ContentFrame.Name = "ContentFrame" ContentFrame.Size = UDim2.new(1, -12, 1, -12) ContentFrame.Position = UDim2.new(0, 6, 0, 6) ContentFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 40) ContentFrame.BackgroundTransparency = 0.4 ContentFrame.BorderSizePixel = 0 ContentFrame.Parent = MainFrame local ContentCorner = Instance.new("UICorner") ContentCorner.CornerRadius = UDim.new(0, 17) ContentCorner.Parent = ContentFrame local BorderStroke = Instance.new("UIStroke") BorderStroke.Color = Color3.fromRGB(100, 80, 150) BorderStroke.Thickness = 1.5 BorderStroke.Transparency = 0.5 BorderStroke.Parent = ContentFrame local TitleLabel = Instance.new("TextLabel") TitleLabel.Name = "TitleLabel" TitleLabel.Size = UDim2.new(1, 0, 0, 50) TitleLabel.Position = UDim2.new(0, 0, 0, 20) TitleLabel.BackgroundTransparency = 1 TitleLabel.Text = "Distancing By Maxx." TitleLabel.TextColor3 = Color3.fromRGB(255, 255, 255) TitleLabel.TextSize = 26 TitleLabel.Font = Enum.Font.GothamBold TitleLabel.TextXAlignment = Enum.TextXAlignment.Center TitleLabel.Parent = ContentFrame local TitleGradient = Instance.new("UIGradient") TitleGradient.Color = ColorSequence.new({ ColorSequenceKeypoint.new(0, Color3.fromRGB(200, 150, 255)), ColorSequenceKeypoint.new(0.5, Color3.fromRGB(255, 255, 255)), ColorSequenceKeypoint.new(1, Color3.fromRGB(150, 200, 255)) }) TitleGradient.Parent = TitleLabel local ToggleContainer = Instance.new("Frame") ToggleContainer.Name = "ToggleContainer" ToggleContainer.Size = UDim2.new(0, 140, 0, 60) ToggleContainer.Position = UDim2.new(0.5, -70, 0, 75) ToggleContainer.BackgroundTransparency = 1 ToggleContainer.Parent = ContentFrame local ToggleTrack = Instance.new("Frame") ToggleTrack.Name = "ToggleTrack" ToggleTrack.Size = UDim2.new(0, 80, 0, 40) ToggleTrack.Position = UDim2.new(0.5, -40, 0.5, -20) ToggleTrack.BackgroundColor3 = Color3.fromRGB(50, 50, 70) ToggleTrack.BorderSizePixel = 0 ToggleTrack.Parent = ToggleContainer local TrackCorner = Instance.new("UICorner") TrackCorner.CornerRadius = UDim.new(1, 0) TrackCorner.Parent = ToggleTrack local TrackStroke = Instance.new("UIStroke") TrackStroke.Color = Color3.fromRGB(80, 80, 100) TrackStroke.Thickness = 2 TrackStroke.Parent = ToggleTrack local ToggleKnob = Instance.new("Frame") ToggleKnob.Name = "ToggleKnob" ToggleKnob.Size = UDim2.new(0, 32, 0, 32) ToggleKnob.Position = UDim2.new(0, 4, 0.5, -16) ToggleKnob.BackgroundColor3 = Color3.fromRGB(220, 220, 220) ToggleKnob.BorderSizePixel = 0 ToggleKnob.Parent = ToggleTrack local KnobCorner = Instance.new("UICorner") KnobCorner.CornerRadius = UDim.new(1, 0) KnobCorner.Parent = ToggleKnob local KnobGlow = Instance.new("Frame") KnobGlow.Name = "KnobGlow" KnobGlow.Size = UDim2.new(0.6, 0, 0.6, 0) KnobGlow.Position = UDim2.new(0.2, 0, 0.2, 0) KnobGlow.BackgroundColor3 = Color3.fromRGB(255, 255, 255) KnobGlow.BackgroundTransparency = 0.5 KnobGlow.BorderSizePixel = 0 KnobGlow.Parent = ToggleKnob local KnobGlowCorner = Instance.new("UICorner") KnobGlowCorner.CornerRadius = UDim.new(1, 0) KnobGlowCorner.Parent = KnobGlow local StatusLabel = Instance.new("TextLabel") StatusLabel.Name = "StatusLabel" StatusLabel.Size = UDim2.new(1, 0, 0, 30) StatusLabel.Position = UDim2.new(0, 0, 0, 145) StatusLabel.BackgroundTransparency = 1 StatusLabel.Text = "⚡ Status: DISABLED" StatusLabel.TextColor3 = Color3.fromRGB(150, 150, 170) StatusLabel.TextSize = 16 StatusLabel.Font = Enum.Font.GothamMedium StatusLabel.TextXAlignment = Enum.TextXAlignment.Center StatusLabel.Parent = ContentFrame local ToggleOnSound = Instance.new("Sound") ToggleOnSound.Name = "ToggleOnSound" ToggleOnSound.SoundId = "rbxassetid://6042053626" ToggleOnSound.Volume = 0.6 ToggleOnSound.PlaybackSpeed = 1.1 ToggleOnSound.Parent = ScreenGui local ToggleOffSound = Instance.new("Sound") ToggleOffSound.Name = "ToggleOffSound" ToggleOffSound.SoundId = "rbxassetid://6042053626" ToggleOffSound.Volume = 0.5 ToggleOffSound.PlaybackSpeed = 0.85 ToggleOffSound.Parent = ScreenGui local dragging = false local dragInput = nil local dragStart = nil local startPos = nil local function updateDragPosition(input) if not dragging then return end local delta = input.Position - dragStart MainFrame.Position = UDim2.new( startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y ) end MainFrame.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then local absolutePos = ToggleTrack.AbsolutePosition local absoluteSize = ToggleTrack.AbsoluteSize local inputPos = input.Position if inputPos.X >= absolutePos.X and inputPos.X <= absolutePos.X + absoluteSize.X and inputPos.Y >= absolutePos.Y and inputPos.Y <= absolutePos.Y + absoluteSize.Y then return end dragging = true dragStart = input.Position startPos = MainFrame.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) MainFrame.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then dragInput = input end end) UserInputService.InputChanged:Connect(function(input) if input == dragInput then updateDragPosition(input) end end) local function setupBodyMovers() local character = LocalPlayer.Character if not character then return end local humanoidRootPart = character:FindFirstChild("HumanoidRootPart") if not humanoidRootPart then return end if bodyVelocity then bodyVelocity:Destroy() end if bodyGyro then bodyGyro:Destroy() end bodyVelocity = Instance.new("BodyVelocity") bodyVelocity.Name = "DistancingVelocity" bodyVelocity.MaxForce = Vector3.new(0, 0, 0) bodyVelocity.Velocity = Vector3.new(0, 0, 0) bodyVelocity.P = 1250 bodyVelocity.Parent = humanoidRootPart bodyGyro = Instance.new("BodyGyro") bodyGyro.Name = "DistancingGyro" bodyGyro.MaxTorque = Vector3.new(0, 0, 0) bodyGyro.P = 3000 bodyGyro.D = 100 bodyGyro.Parent = humanoidRootPart return true end local function cleanupBodyMovers() if bodyVelocity then bodyVelocity:Destroy() bodyVelocity = nil end if bodyGyro then bodyGyro:Destroy() bodyGyro = nil end end local function toggleAI() isEnabled = not isEnabled local tweenInfo = TweenInfo.new(0.25, Enum.EasingStyle.Back, Enum.EasingDirection.Out) if isEnabled then setupBodyMovers() TweenService:Create(ToggleKnob, tweenInfo, { Position = UDim2.new(0, 44, 0.5, -16), BackgroundColor3 = Color3.fromRGB(255, 255, 255) }):Play() TweenService:Create(ToggleTrack, tweenInfo, { BackgroundColor3 = Color3.fromRGB(80, 200, 120) }):Play() TweenService:Create(TrackStroke, tweenInfo, { Color = Color3.fromRGB(100, 220, 140) }):Play() StatusLabel.Text = "⚡ Status: ACTIVE" TweenService:Create(StatusLabel, tweenInfo, { TextColor3 = Color3.fromRGB(100, 220, 140) }):Play() ToggleOnSound:Play() else cleanupBodyMovers() TweenService:Create(ToggleKnob, tweenInfo, { Position = UDim2.new(0, 4, 0.5, -16), BackgroundColor3 = Color3.fromRGB(220, 220, 220) }):Play() TweenService:Create(ToggleTrack, tweenInfo, { BackgroundColor3 = Color3.fromRGB(50, 50, 70) }):Play() TweenService:Create(TrackStroke, tweenInfo, { Color = Color3.fromRGB(80, 80, 100) }):Play() StatusLabel.Text = "⚡ Status: DISABLED" TweenService:Create(StatusLabel, tweenInfo, { TextColor3 = Color3.fromRGB(150, 150, 170) }):Play() ToggleOffSound:Play() currentVelocity = Vector3.new(0, 0, 0) targetVelocity = Vector3.new(0, 0, 0) currentWaypoints = {} end end ToggleTrack.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then toggleAI() end end) local gradientAngle = 0 local glowPhase = 0 RunService.RenderStepped:Connect(function(dt) gradientAngle = (gradientAngle + dt * 15) % 360 MainGradient.Rotation = gradientAngle glowPhase = glowPhase + dt local glow1X = 0.25 + math.sin(glowPhase * 0.8) * 0.15 local glow1Y = 0.2 + math.cos(glowPhase * 0.6) * 0.1 GlowOrb.Position = UDim2.new(glow1X, 0, glow1Y, 0) GlowOrb.BackgroundTransparency = 0.65 + math.sin(glowPhase * 2) * 0.1 local glow2X = 0.45 + math.cos(glowPhase * 0.7) * 0.12 local glow2Y = 0.35 + math.sin(glowPhase * 0.9) * 0.08 GlowOrb2.Position = UDim2.new(glow2X, 0, glow2Y, 0) GlowOrb2.BackgroundTransparency = 0.7 + math.cos(glowPhase * 1.5) * 0.1 TitleGradient.Offset = Vector2.new(math.sin(glowPhase * 2) * 0.3, 0) end) local function getNearestPlayer() local character = LocalPlayer.Character if not character then return nil, math.huge end local humanoidRootPart = character:FindFirstChild("HumanoidRootPart") if not humanoidRootPart then return nil, math.huge end local myPosition = humanoidRootPart.Position local nearestPlayer = nil local nearestDistance = math.huge for _, player in pairs(Players:GetPlayers()) do if player ~= LocalPlayer then local otherCharacter = player.Character if otherCharacter then local otherHRP = otherCharacter:FindFirstChild("HumanoidRootPart") if otherHRP then local distance = (myPosition - otherHRP.Position).Magnitude if distance < nearestDistance then nearestDistance = distance nearestPlayer = player end end end end end return nearestPlayer, nearestDistance end local function isPathBlocked(origin, direction, distance) if direction.Magnitude < 0.01 then return false end local raycastParams = RaycastParams.new() raycastParams.FilterType = Enum.RaycastFilterType.Exclude raycastParams.FilterDescendantsInstances = {LocalPlayer.Character} local result = workspace:Raycast(origin, direction.Unit * distance, raycastParams) return result ~= nil, result end local function findBestEscapeDirection(myPos, threatPos) local baseDirection = (myPos - threatPos) baseDirection = Vector3.new(baseDirection.X, 0, baseDirection.Z) if baseDirection.Magnitude < 0.1 then baseDirection = Vector3.new(1, 0, 0) else baseDirection = baseDirection.Unit end local testAngles = {0, 25, -25, 50, -50, 75, -75, 100, -100, 130, -130, 160, -160} local bestDirection = baseDirection local bestScore = -math.huge local needsJump = false for _, angle in ipairs(testAngles) do local rad = math.rad(angle) local testDir = Vector3.new( baseDirection.X * math.cos(rad) - baseDirection.Z * math.sin(rad), 0, baseDirection.X * math.sin(rad) + baseDirection.Z * math.cos(rad) ) local lowBlocked = isPathBlocked(myPos + Vector3.new(0, 0.5, 0), testDir, 5) local midBlocked = isPathBlocked(myPos + Vector3.new(0, 2.5, 0), testDir, 5) local highBlocked = isPathBlocked(myPos + Vector3.new(0, 5, 0), testDir, 5) local score = 100 - math.abs(angle) if not lowBlocked then score = score + 60 elseif not midBlocked then score = score + 30 needsJump = true elseif not highBlocked then score = score + 10 else score = score - 150 end local dotProduct = testDir:Dot(baseDirection) score = score + dotProduct * 25 if score > bestScore then bestScore = score bestDirection = testDir if not lowBlocked then needsJump = false end end end return bestDirection.Unit, needsJump end local function shouldJumpOverObstacle(myPos, direction) if direction.Magnitude < 0.01 then return false end local raycastParams = RaycastParams.new() raycastParams.FilterType = Enum.RaycastFilterType.Exclude raycastParams.FilterDescendantsInstances = {LocalPlayer.Character} local lowHit = workspace:Raycast(myPos + Vector3.new(0, 1.5, 0), direction.Unit * 3, raycastParams) if lowHit then local highCheck = workspace:Raycast(myPos + Vector3.new(0, 6, 0), direction.Unit * 3, raycastParams) if not highCheck then return true end end return false end local pathfindingAgent = PathfindingService:CreatePath({ AgentRadius = 2, AgentHeight = 5, AgentCanJump = true, AgentJumpHeight = 7, AgentMaxSlope = 45, Costs = { Water = 100 } }) local function usePathfindingEscape(myPos, threatPos) local character = LocalPlayer.Character if not character then return false end local escapeDir = (myPos - threatPos) escapeDir = Vector3.new(escapeDir.X, 0, escapeDir.Z) if escapeDir.Magnitude < 0.1 then escapeDir = Vector3.new(1, 0, 0) else escapeDir = escapeDir.Unit end local targetPos = myPos + escapeDir * 15 local success = pcall(function() pathfindingAgent:ComputeAsync(myPos, targetPos) end) if success and pathfindingAgent.Status == Enum.PathStatus.Success then currentWaypoints = pathfindingAgent:GetWaypoints() currentWaypointIndex = 2 lastPathfindTime = tick() return true end return false end local function applyMovement(direction, shouldJump, dt) local character = LocalPlayer.Character if not character then return end local humanoid = character:FindFirstChild("Humanoid") local humanoidRootPart = character:FindFirstChild("HumanoidRootPart") if not humanoid or not humanoidRootPart then return end if humanoid.Health <= 0 then return end if not bodyVelocity or not bodyVelocity.Parent then setupBodyMovers() return end if direction.Magnitude > 0.01 then targetVelocity = direction.Unit * CONFIG.MOVE_SPEED else targetVelocity = Vector3.new(0, 0, 0) end currentVelocity = currentVelocity:Lerp(targetVelocity, CONFIG.SMOOTHING_FACTOR) if currentVelocity.Magnitude > 0.1 then bodyVelocity.MaxForce = Vector3.new(10000, 0, 10000) bodyVelocity.Velocity = Vector3.new(currentVelocity.X, 0, currentVelocity.Z) else bodyVelocity.MaxForce = Vector3.new(0, 0, 0) bodyVelocity.Velocity = Vector3.new(0, 0, 0) end if shouldJump and (tick() - lastJumpTime) > CONFIG.JUMP_COOLDOWN then if humanoid.FloorMaterial ~= Enum.Material.Air then humanoid:ChangeState(Enum.HumanoidStateType.Jumping) lastJumpTime = tick() end end end local function faceTarget(targetPlayer) local character = LocalPlayer.Character if not character then return end local humanoidRootPart = character:FindFirstChild("HumanoidRootPart") local targetCharacter = targetPlayer.Character if not humanoidRootPart or not targetCharacter then return end local targetHRP = targetCharacter:FindFirstChild("HumanoidRootPart") if not targetHRP then return end if not bodyGyro or not bodyGyro.Parent then setupBodyMovers() return end local lookDir = (targetHRP.Position - humanoidRootPart.Position) lookDir = Vector3.new(lookDir.X, 0, lookDir.Z) if lookDir.Magnitude < 0.1 then return end bodyGyro.MaxTorque = Vector3.new(0, 10000, 0) bodyGyro.CFrame = CFrame.lookAt(humanoidRootPart.Position, humanoidRootPart.Position + lookDir) end local function disableFacing() if bodyGyro and bodyGyro.Parent then bodyGyro.MaxTorque = Vector3.new(0, 0, 0) end end local function stopMovement() targetVelocity = Vector3.new(0, 0, 0) if bodyVelocity and bodyVelocity.Parent then bodyVelocity.MaxForce = Vector3.new(0, 0, 0) bodyVelocity.Velocity = Vector3.new(0, 0, 0) end currentVelocity = currentVelocity:Lerp(Vector3.new(0, 0, 0), 0.2) end RunService.Heartbeat:Connect(function(dt) if not isEnabled then stopMovement() return end local character = LocalPlayer.Character if not character then return end local humanoidRootPart = character:FindFirstChild("HumanoidRootPart") local humanoid = character:FindFirstChild("Humanoid") if not humanoidRootPart or not humanoid then return end if humanoid.Health <= 0 then return end local myPosition = humanoidRootPart.Position local nearestPlayer, distance = getNearestPlayer() if nearestPlayer and distance <= CONFIG.DETECTION_RADIUS then local targetCharacter = nearestPlayer.Character if not targetCharacter then return end local targetHRP = targetCharacter:FindFirstChild("HumanoidRootPart") if not targetHRP then return end local threatPosition = targetHRP.Position if distance <= CONFIG.FLEE_RADIUS then disableFacing() local escapeDirection, needsJump = findBestEscapeDirection(myPosition, threatPosition) local directPathBlocked = isPathBlocked( myPosition + Vector3.new(0, 1, 0), escapeDirection, 4 ) if directPathBlocked then if tick() - lastPathfindTime > CONFIG.PATHFIND_TIMEOUT then usePathfindingEscape(myPosition, threatPosition) end if #currentWaypoints > 0 and currentWaypointIndex <= #currentWaypoints then local waypoint = currentWaypoints[currentWaypointIndex] local waypointDir = (waypoint.Position - myPosition) waypointDir = Vector3.new(waypointDir.X, 0, waypointDir.Z) if waypointDir.Magnitude > 1.5 then local shouldJumpWaypoint = waypoint.Action == Enum.PathWaypointAction.Jump applyMovement(waypointDir.Unit, shouldJumpWaypoint, dt) else currentWaypointIndex = currentWaypointIndex + 1 end else needsJump = needsJump or shouldJumpOverObstacle(myPosition, escapeDirection) applyMovement(escapeDirection, needsJump, dt) end else needsJump = needsJump or shouldJumpOverObstacle(myPosition, escapeDirection) applyMovement(escapeDirection, needsJump, dt) currentWaypoints = {} end else stopMovement() faceTarget(nearestPlayer) end else stopMovement() disableFacing() currentWaypoints = {} end end) LocalPlayer.CharacterAdded:Connect(function(newCharacter) newCharacter:WaitForChild("HumanoidRootPart") newCharacter:WaitForChild("Humanoid") if isEnabled then wait(0.1) setupBodyMovers() end end) ScreenGui.Destroying:Connect(function() isEnabled = false cleanupBodyMovers() end) print("╔═══════════════════════════════════════════════════════════════╗") print("║ DISTANCING BY MAXX - LOADED SUCCESSFULLY ║") print("╚═══════════════════════════════════════════════════════════════╝")