local Players = game:GetService("Players") local RunService = game:GetService("RunService") local LocalPlayer = Players.LocalPlayer local character, humanoidRootPart, humanoid = nil, nil, nil local lastTarget = nil local confusionTimer = 0 local confusedYaw = 0 local canConfuse = false -- Get nearest alive player local function getNearestAlivePlayer(ignoreStrong) local closestChar = nil local shortestDist = math.huge if not humanoidRootPart then return end for _, player in ipairs(Players:GetPlayers()) do if player ~= LocalPlayer and player.Character then local hrp = player.Character:FindFirstChild("HumanoidRootPart") local hum = player.Character:FindFirstChild("Humanoid") if hrp and hum and hum.Health > 0 then if ignoreStrong and hum.Health > 500 and LocalPlayer.Name ~= "Guest1337" then continue end local dist = (hrp.Position - humanoidRootPart.Position).Magnitude if dist < shortestDist then shortestDist = dist closestChar = player.Character end end end end return closestChar, shortestDist end -- Predict future position local function getPredictedPosition(char) local hrp = char:FindFirstChild("HumanoidRootPart") local hum = char:FindFirstChild("Humanoid") if not hrp or not hum then return hrp and hrp.Position or Vector3.zero end local moveDir = hum.MoveDirection local facingDir = hrp.CFrame.LookVector local walkSpeed = hum.WalkSpeed local moveWeight = 0.2 local aimWeight = 0.1 return hrp.Position + (moveDir * walkSpeed * moveWeight) + (facingDir.Unit * walkSpeed * aimWeight) end -- Setup local function onCharacterAdded(char) character = char char:WaitForChild("HumanoidRootPart") char:WaitForChild("Humanoid") humanoidRootPart = char:FindFirstChild("HumanoidRootPart") humanoid = char:FindFirstChild("Humanoid") humanoid.AutoRotate = false lastTarget = nil confusionTimer = 0 canConfuse = false end -- Init if LocalPlayer.Character then onCharacterAdded(LocalPlayer.Character) end LocalPlayer.CharacterAdded:Connect(onCharacterAdded) -- Main loop RunService.RenderStepped:Connect(function(deltaTime) if not humanoid or not humanoidRootPart or humanoid.Health <= 0 then return end -- Enable confusion once player starts moving if not canConfuse and humanoid.MoveDirection.Magnitude > 0 then canConfuse = true end if humanoid.Health > 500 then local targetChar = getNearestAlivePlayer(false) if lastTarget and lastTarget ~= targetChar then local lastHum = lastTarget:FindFirstChild("Humanoid") if lastHum and lastHum.Health <= 0 and canConfuse then confusionTimer = math.random(15, 25) / 10 -- 1.5–2.5 seconds confusedYaw = math.rad(math.random(-180, 180)) end end lastTarget = targetChar if confusionTimer > 0 then confusionTimer -= deltaTime local confusedLook = CFrame.new(humanoidRootPart.Position) * CFrame.Angles(0, confusedYaw, 0) humanoidRootPart.CFrame = humanoidRootPart.CFrame:Lerp(confusedLook, math.clamp(deltaTime * 5, 0, 1)) elseif targetChar then local predictedPos = getPredictedPosition(targetChar) local dir = predictedPos - humanoidRootPart.Position dir = Vector3.new(dir.X, 0, dir.Z).Unit local goalCFrame = CFrame.lookAt(humanoidRootPart.Position, humanoidRootPart.Position + dir) local currentDir = humanoidRootPart.CFrame.LookVector currentDir = Vector3.new(currentDir.X, 0, currentDir.Z).Unit local angleDiff = math.deg(math.acos(math.clamp(currentDir:Dot(dir), -1, 1))) if angleDiff > 5 then humanoidRootPart.CFrame = humanoidRootPart.CFrame:Lerp(goalCFrame, math.clamp(deltaTime * 8, 0, 1)) else humanoidRootPart.CFrame = goalCFrame end end else local moveDir = humanoid.MoveDirection local targetChar = getNearestAlivePlayer(true) if moveDir.Magnitude > 0.1 and targetChar then local moveVec = Vector3.new(moveDir.X, 0, moveDir.Z).Unit local targetVec = (getPredictedPosition(targetChar) - humanoidRootPart.Position).Unit targetVec = Vector3.new(targetVec.X, 0, targetVec.Z).Unit local blendedDir = moveVec:Lerp(targetVec, 0.65).Unit local lookCFrame = CFrame.lookAt(humanoidRootPart.Position, humanoidRootPart.Position + blendedDir) humanoidRootPart.CFrame = humanoidRootPart.CFrame:Lerp(lookCFrame, math.clamp(deltaTime * 10, 0, 1)) elseif moveDir.Magnitude > 0.1 then local moveVec = Vector3.new(moveDir.X, 0, moveDir.Z).Unit local lookCFrame = CFrame.lookAt(humanoidRootPart.Position, humanoidRootPart.Position + moveVec) humanoidRootPart.CFrame = humanoidRootPart.CFrame:Lerp(lookCFrame, math.clamp(deltaTime * 10, 0, 1)) end lastTarget = nil confusionTimer = 0 end end)