Advertisement
Guest User

Untitled

a guest
Mar 28th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. _G.Normal = true
  2. while _G.Normal == true do
  3. local players = game:service'Players';
  4. local tweenService = game:service'TweenService';
  5. local runService = game:service'RunService';
  6. local replicatedStorage = game:service'ReplicatedStorage';
  7. local virtualUser = game:service'VirtualUser';
  8. local camera = workspace.CurrentCamera
  9. local player = players.LocalPlayer;
  10. local playerGui = player.PlayerGui;
  11. local vec3New = Vector3.new;
  12. local vec2New = Vector2.new;
  13. local cframeNew = CFrame.new;
  14. local tweenInfoNew = TweenInfo.new;
  15. local constVec = vec3New(0, 5, 0);
  16. local constVec2 = vec2New(0, 0);
  17. local mouse = player:GetMouse();
  18.  
  19. local equipRemote = replicatedStorage.Remotes.E;
  20.  
  21. local function getNearestMob()
  22. local nearestM, nearest = 9e9;
  23. local playerHum = player.Character.HumanoidRootPart;
  24. local workspaceChild = workspace:GetChildren();
  25. for i = 1, #workspaceChild do
  26. local v = workspaceChild[i];
  27. local mobHum = v:FindFirstChild("Humanoid");
  28. if v:IsA'Model' and v.Name:find'Demon' and not players:FindFirstChild(v.Name) and mobHum and mobHum.Health > 0 then
  29. local mobRootPart = v.HumanoidRootPart;
  30. local magnitude = (playerHum.Position - mobRootPart.Position).Magnitude;
  31. if magnitude < nearestM then
  32. nearestM = magnitude;
  33. nearest = mobRootPart;
  34. end
  35. end
  36. end
  37. return nearest, nearestM, playerHum
  38. end
  39.  
  40. while _G.Normal == true do
  41. local nearest, distance, playerHum = getNearestMob();
  42. if nearest then
  43. local mob = nearest.Parent;
  44. repeat
  45. mob.Humanoid.Health = 0
  46. mob.Humanoid.Health = 0
  47. until wait()
  48. end
  49. wait();
  50. end;
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement