Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---legit Zombies' Farm---
- game.Players.LocalPlayer.CharacterAdded:Connect(function()
- task.wait(1)
- spawn(function()
- while task.wait() do
- pcall(function()
- if not game.Players.LocalPlayer.Character:FindFirstChild("Machete") then
- game.Players.LocalPlayer.Character.Humanoid:EquipTool(game.Players.LocalPlayer.Backpack.Machete)
- else
- game.Players.LocalPlayer.Character.Machete:Activate()
- end
- end)
- end
- end)
- while true do
- task.wait()
- pcall(function()
- local zombies = {}
- local distances = {}
- local hrp = game.Players.LocalPlayer.Character.HumanoidRootPart
- local humanoid = game.Players.LocalPlayer.Character.Humanoid
- for i, v in pairs(workspace:GetChildren()) do
- if v:FindFirstChild("Reward") and v:FindFirstChild("Move") then
- if v:FindFirstChild("HumanoidRootPart") then
- table.insert(zombies, v)
- end
- end
- end
- for i, v in pairs(zombies) do
- table.insert(distances, {(hrp.Position - v.HumanoidRootPart.Position).Magnitude, v})
- end
- repeat
- task.wait()
- for i, v in pairs(distances) do
- if distances[i + 1] then
- print(v[i])
- --print(i) debug
- if v[1] > distances[i + 1][1] then
- table.remove(distances, i)
- else
- table.remove(distances, i + 1)
- end
- end
- end
- until not distances[2]
- local zombie = distances[1][2]
- print(zombie, distances[1][1]) --debug
- local pathfinder = game:GetService("PathfindingService")
- local pathy = pathfinder:CreatePath()
- pathy:ComputeAsync(hrp.Position, zombie.HumanoidRootPart.Position)
- if pathy.Status == Enum.PathStatus.Success then
- for i, v in pairs(pathy:GetWaypoints()) do
- local pos = v.Position
- humanoid:MoveTo(pos)
- humanoid.MoveToFinished:Wait()
- end
- else
- hrp.CFrame = hrp.CFrame + Vector3.new(0, 100, 0)
- task.wait(1)
- if pathy.Status == Enum.PathStatus.Success then
- for i, v in pairs(pathy:GetWaypoints()) do
- local pos = v.Position
- humanoid:MoveTo(pos)
- humanoid.MoveToFinished:Wait()
- end
- else
- warn("Pathfinding unsuccessful, waiting...")
- task.wait(2)
- end
- end
- end)
- end
- end)
- game.Players.LocalPlayer.Character.Head:Destroy()
- -----------------------------------------------------------------------------------------
- ---Mission and Level Farm---
- game.Players.LocalPlayer.CharacterAdded:Connect(function()
- task.wait(3)
- spawn(function()
- while task.wait() do
- pcall(function()
- if not game.Players.LocalPlayer.Character:FindFirstChild("Machete") then
- game.Players.LocalPlayer.Character.Humanoid:EquipTool(game.Players.LocalPlayer.Backpack.Machete)
- else
- game.Players.LocalPlayer.Character.Machete:Activate()
- end
- end)
- end
- end)
- while true do
- task.wait()
- pcall(function()
- local zombies = {}
- local distances = {}
- local hrp = game.Players.LocalPlayer.Character.HumanoidRootPart
- local humanoid = game.Players.LocalPlayer.Character.Humanoid
- if game:GetService("Players").LocalPlayer.Quest.Num.Value == 0 then
- hrp.CFrame = game:GetService("Workspace").Quests["Level 1 Quest"].Quest.ClickPart.CFrame
- task.wait(0.1)
- fireproximityprompt(game:GetService("Workspace").Quests["Level 1 Quest"].Quest.ClickPart.ProximityPrompt)
- task.wait(0.1)
- game:GetService("Players").LocalPlayer.PlayerGui.QuestTake.Accept.RemoteEvent:FireServer()
- end
- for i, v in pairs(workspace:GetChildren()) do
- if v:FindFirstChild("Reward") and v:FindFirstChild("Move") then
- if v:FindFirstChild("HumanoidRootPart") then
- table.insert(zombies, v)
- end
- end
- end
- for i, v in pairs(zombies) do
- if (hrp.Position - v.HumanoidRootPart.Position).Magnitude ~= math.huge then --this is totally necessary, stfu
- table.insert(distances, {(hrp.Position - v.HumanoidRootPart.Position).Magnitude, v})
- end
- end
- repeat
- task.wait()
- for i, v in pairs(distances) do
- if distances[i + 1] then
- print(v[i])
- --print(i) debug
- if v[1] > distances[i + 1][1] then
- table.remove(distances, i)
- else
- table.remove(distances, i + 1)
- end
- end
- end
- until not distances[2]
- local zombie = distances[1][2]
- print(zombie, distances[1][1]) --debug
- hrp.CFrame = zombie.HumanoidRootPart.CFrame
- end)
- end
- end)
- game.Players.LocalPlayer.Character.Head:Destroy()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement