local part = Instance.new("Part",workspace) part.CanCollide = false part.CanQuery = false part.Anchored = true local weld = Instance.new("WeldConstraint",part) repeat wait() until game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart") ~= nil part.Size = game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart").Size part.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame extraY = 80 weld.Part0 = part weld.Part1 = game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart") task.wait() weld.Enabled = false game.Workspace.CurrentCamera.CameraSubject = part game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom local syney = 10 local bind = Instance.new("BindableEvent") local function isNPCMoving(npc) if npc== nil or npc.PrimaryPart == nil then return false end local previousPosition = npc.PrimaryPart.Position task.wait() -- Current position local currentPosition = npc.PrimaryPart.Position -- Calculate the distance moved local distance = (currentPosition - previousPosition).magnitude -- Update the previous position previousPosition = currentPosition -- Return true if the NPC has moved, otherwise false return distance > 0 end local function gettarget() local target = nil local distance = math.huge local Banned3 = {} for i,v in pairs(game.Players:GetPlayers()) do table.insert(Banned3,v.Character) end for i,v in pairs(game.Workspace:GetDescendants()) do if v:IsA("Humanoid") and v.Parent:FindFirstChildWhichIsA("BasePart") and isNPCMoving(v.Parent) == true and table.find(Banned3,v.Parent) == nil and v.Health> 0 and v.Parent:FindFirstChildWhichIsA("BasePart").Anchored == false and (v.Parent:FindFirstChildWhichIsA("BasePart").Position-game.Players.LocalPlayer.Character.HumanoidRootPart.Position).Magnitude < distance then target = v.Parent distance = (v.Parent:FindFirstChildWhichIsA("BasePart").Position-game.Players.LocalPlayer.Character.HumanoidRootPart.Position).Magnitude end end return target end bind.Event:Connect(function() task.wait() syney +=1 if syney >= 20 then syney = 10 end game.Workspace.Gravity = 80 local tar = nil local tar =gettarget() if tar == nil or (tar ~= nil and tar:FindFirstChildWhichIsA("BasePart").Position.Y > part.Position.Y) then part.CFrame = (CFrame.new(part.Position+game.Players.LocalPlayer.Character:FindFirstChildWhichIsA("Humanoid").MoveDirection*16)) else part.CFrame = (CFrame.new(Vector3.new(game.Players.LocalPlayer.Character.PrimaryPart.Position.X,tar:FindFirstChildWhichIsA("BasePart").Position.Y,game.Players.LocalPlayer.Character.PrimaryPart.Position.Z)+game.Players.LocalPlayer.Character:FindFirstChildWhichIsA("Humanoid").MoveDirection*16)) end game.Players.LocalPlayer.Character:SetPrimaryPartCFrame(part.CFrame*CFrame.new(0,(syney*10)+extraY,0)) end) game.Workspace.DescendantAdded:Connect(function(v) if (v:IsA("BasePart") or v:IsA("UnionOperation") ) and v.Parent:FindFirstChildWhichIsA("Humanoid") == nil then v.CanTouch = false end end) delay(0,function() game:GetService("RunService").Heartbeat:Connect(function() task.wait() if game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChildWhichIsA("Humanoid") and game.Players.LocalPlayer.Character:FindFirstChildWhichIsA("Humanoid").Health > 0 then bind:Fire() end end) end)