Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _G.range = math.huge
- _G.loop = false
- _G.teleportbypass = true
- local lp = game.Players.LocalPlayer
- local rs = game:GetService("RunService").RenderStepped
- local uis = game:GetService("UserInputService").InputBegan
- local pfs = game:GetService("PathfindingService")
- local scanning = false
- local closest, enemy = math.huge, nil
- function attack(entity)
- if entity then
- if lp.Character:FindFirstChild("HumanoidRootPart") and entity:FindFirstChild("HumanoidRootPart") then
- rs:wait()
- if _G.teleportbypass and (enemy.HumanoidRootPart.Position-lp.Character.HumanoidRootPart.Position).magnitude > 10 then
- local path = pfs:FindPathAsync(lp.Character.HumanoidRootPart.Position, entity.HumanoidRootPart.Position)
- local points = path:GetWaypoints()
- for _,v in pairs(points) do
- rs:wait()
- lp.Character.HumanoidRootPart.CFrame = CFrame.new(v.Position)
- end
- else
- lp.Character.HumanoidRootPart.CFrame = entity.HumanoidRootPart.CFrame
- end
- mouse1click()
- end
- end
- end
- function scan()
- if not scanning then
- closest = math.huge
- enemy = nil
- scanning = true
- for _,v in pairs(game.Workspace.Mobs:GetChildren()) do
- if v:FindFirstChild("HumanoidRootPart") then
- local mag = (v.HumanoidRootPart.Position-lp.Character.HumanoidRootPart.Position).magnitude
- if mag <= _G.range and v.Entity.Health.Value > 0 and mag <= closest then
- closest = mag
- enemy = v
- end
- end
- end
- repeat attack(enemy) until enemy.Entity.Health.Value <= 0 or not enemy or not enemy:FindFirstChild("HumanoidRootPart")
- scanning = false
- if _G.loop then
- scan()
- end
- end
- end
- uis:connect(function(key)
- if key.KeyCode == Enum.KeyCode.T then
- spawn(function()
- if _G.loop then
- _G.loop = false
- else
- _G.loop = true
- end
- end)
- scan()
- elseif key.KeyCode == Enum.KeyCode.Y then
- scan()
- elseif key.KeyCode == Enum.KeyCode.U then
- spawn(function()
- if _G.teleportbypass then
- _G.teleportbypass = false
- else
- _G.teleportbypass = true
- end
- end)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment