Advertisement
IHATEMICROWAVEOVEN

Marisad

Oct 16th, 2021
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. -- SETTINGS
  2. local initialvelocity = 150
  3. local timecap = 4
  4.  
  5. -- SCRIPT
  6. function Use(...)
  7. local isthisdone = true
  8. local timecounter = 0
  9. local shouldistrafe = 0
  10. local args = {...}
  11. local nearestdistance = math.huge
  12. local nearestplayer
  13. for _, i in pairs(game.Players:GetPlayers()) do
  14. local distancecheck = i:DistanceFromCharacter(args[1].Torso.Position)
  15. if distancecheck < nearestdistance then
  16. nearestplayer = i
  17. nearestdistance = distancecheck
  18. end
  19. end
  20. coroutine.wrap(function()
  21. while isthisdone == true do
  22. for i=0, 1, 0.1 do
  23. args[1].HumanoidRootPart.CFrame = args[1].HumanoidRootPart.CFrame:lerp(CFrame.lookAt(args[1].HumanoidRootPart.Position, nearestplayer.Character.Torso.Position), i)
  24. --args[1].HumanoidRootPart.CFrame *= CFrame.Angles(0,math.rad(1),0)
  25. wait()
  26. end
  27. end
  28. end)()
  29. local bv = args[1].Torso:FindFirstChildOfClass("BodyVelocity") or Instance.new("BodyVelocity", args[1].Torso)
  30. bv.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  31. while timecap > timecounter do
  32. bv.velocity = (args[1].Torso.CFrame * CFrame.Angles(0,math.rad(90*math.ceil(shouldistrafe)),0)).LookVector * initialvelocity * (1 - (timecounter / timecap))
  33. if timecounter > timecap/4 and (args[1].Torso.Position - nearestplayer.Character.Torso.Position).Magnitude < (initialvelocity * (1.25 - (timecounter / timecap))) and math.random(1,50) == 1 and shouldistrafe == 0 then
  34. timecounter -= timecap/4
  35. shouldistrafe = 0.9
  36. end
  37. timecounter += 0.1
  38. if shouldistrafe > 0 then
  39. shouldistrafe -= 0.1
  40. end
  41. if shouldistrafe == 0 then
  42. timecounter -= timecap/8
  43. end
  44. wait(0.1)
  45. end
  46. local explosion = Instance.new("Explosion", args[1].Torso)
  47. explosion.DestroyJointRadiusPercent = 0
  48. explosion.BlastPressure = 0
  49. explosion.Position = args[1].Torso.Position
  50. bv.velocity *= 0
  51. isthisdone = false
  52. end
  53.  
  54. return Use
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement