Advertisement
Guest User

Untitled

a guest
Apr 1st, 2020
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. ~~Script Made By Lucifer#8888
  2. local players = game:service'Players';
  3. local tweenService = game:service'TweenService';
  4. local runService = game:service'RunService';
  5. local replicatedStorage = game:service'ReplicatedStorage';
  6. local virtualUser = game:service'VirtualUser';
  7. local camera = workspace.CurrentCamera
  8. local player = players.LocalPlayer;
  9. local playerGui = player.PlayerGui;
  10. local vec3New = Vector3.new;
  11. local vec2New = Vector2.new;
  12. local cframeNew = CFrame.new;
  13. local tweenInfoNew = TweenInfo.new;
  14. local constVec = vec3New(0, 5, 0);
  15. local constVec2 = vec2New(0, 0);
  16. local mouse = player:GetMouse();
  17.  
  18. local equipRemote = replicatedStorage.Remotes.E;
  19.  
  20. local function punch()
  21. virtualUser:Button1Down(constVec2, camera.CFrame);
  22. end
  23. local function equip()
  24. if player.Character:WaitForChild('Humanoid').Equip.Value then return end;
  25. local headBillGui = player.Character.Head:FindFirstChild("HeadBillGui");
  26. if headBillGui then
  27. headBillGui:Destroy();
  28. end
  29. equipRemote:FireServer(true);
  30. wait(1.1);
  31. end
  32.  
  33. local function getNearestMob()
  34. local nearestM, nearest = 9e9;
  35. local playerHum = player.Character.HumanoidRootPart;
  36. local workspaceChild = workspace:GetChildren();
  37. for i = 1, #workspaceChild do
  38. local v = workspaceChild[i];
  39. local mobHum = v:FindFirstChild("Humanoid");
  40. if v:IsA'Model' and v.Name:find'Demon' and not players:FindFirstChild(v.Name) and mobHum and mobHum.Health > 0 then
  41. local mobRootPart = v.HumanoidRootPart;
  42. local magnitude = (playerHum.Position - mobRootPart.Position).Magnitude;
  43. if magnitude < nearestM then
  44. nearestM = magnitude;
  45. nearest = mobRootPart;
  46. end
  47. end
  48. end
  49. return nearest, nearestM, playerHum
  50. end
  51.  
  52. runService.Stepped:Connect(function()
  53. local humanoid = player.Character:WaitForChild("Humanoid");
  54. humanoid:ChangeState(11);
  55. equip();
  56. punch();
  57. end)
  58.  
  59. while true do
  60. local nearest, distance, playerHum = getNearestMob();
  61. if nearest then
  62. local mob = nearest.Parent;
  63. repeat
  64. local playerCFrame = playerHum.CFrame;
  65. local mobPos = nearest.Position;
  66. local tpCFrame = cframeNew((mobPos - constVec), mobPos)
  67. local tweenBase = tweenService:Create(playerHum, tweenInfoNew(distance / 200), {CFrame = tpCFrame});
  68. tweenBase:Play();
  69. tweenBase.Completed:Wait();
  70. until mob.Humanoid.Health <= 0;
  71. end
  72. wait(3.5);
  73. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement