--CREDIT: -- Script Written and Edited by MawinCK -- Script Fixed and Edited by ChatGPT local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local localroot = character:WaitForChild("HumanoidRootPart") local RunService = game:GetService("RunService") local connection = nil local currentTarget = nil -- Track the current target player local function UpdateTargetPlayers() local newTarget = nil for _, v in pairs(game.Players:GetPlayers()) do if v ~= player and v.Character then local JNR = v.Character:FindFirstChild("Humanoid") if JNR and JNR.Health > 0 then newTarget = v break -- Take the first valid target end end end return newTarget end local function Disconnect() if connection then connection:Disconnect() connection = nil end end local function BringTargetPlayerUntilHealthZero() Disconnect() -- Ensure any previous connections are cleared connection = RunService.RenderStepped:Connect(function() if currentTarget then local JN = currentTarget.Character:FindFirstChild("HumanoidRootPart") local JNR = currentTarget.Character:FindFirstChild("Humanoid") if JN and JNR and JNR.Health > 0 then JN.CFrame = localroot.CFrame * CFrame.new(0, 0, -3) else -- If current target's health is 0 or no longer valid, find a new target currentTarget = UpdateTargetPlayers() end else -- Find a new target if there is no current one currentTarget = UpdateTargetPlayers() end end) end -- Initialize the targeting process currentTarget = UpdateTargetPlayers() BringTargetPlayerUntilHealthZero() player.CharacterAdded:Connect(function(char) character = char localroot = character:WaitForChild("HumanoidRootPart") -- Reinitialize the targeting process currentTarget = UpdateTargetPlayers() BringTargetPlayerUntilHealthZero() end) game.Players.PlayerAdded:Connect(function() -- Reinitialize the targeting process currentTarget = UpdateTargetPlayers() BringTargetPlayerUntilHealthZero() end) game.Players.PlayerRemoving:Connect(function() -- Reinitialize the targeting process currentTarget = UpdateTargetPlayers() BringTargetPlayerUntilHealthZero() end)