TheUnknownDiscord

Untitled

Sep 17th, 2021 (edited)
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local Humanoid = Instance.new("Model", game.Workspace)
  2. Torso = Instance.new("Part", Humanoid)
  3. HumanoidRootPart = Instance.new("Part", Humanoid)
  4. HumanoidRootPart.Transparency = 1
  5. Hum = Instance.new("Humanoid", HumanoidRootPart)
  6. Hum.RigType = "R6"
  7. Torso.Size = Vector3.new(2,2,1)
  8. RightArm = Instance.new("Part", Humanoid)
  9. RightArm.Size = Vector3.new(1,2,1)
  10. RightArm1 = Instance.new("Motor6D")
  11. RightArm1.Parent = Torso
  12. RightArm1.Part0 = Torso
  13. RightArm1.Part1 = RightArm
  14. LeftArm = Instance.new("Part", Humanoid)
  15. LeftArm.Size = Vector3.new(1,2,1)
  16. LeftArm1 = Instance.new("Motor6D")
  17. LeftArm1.Parent = Torso
  18. LeftArm1.Part0 = Torso
  19. LeftArm1.Part1 = LeftArm
  20. LeftLeg = Instance.new("Part", Humanoid)
  21. LeftLeg.Size = Vector3.new(1,2,1)
  22. LeftLeg1 = Instance.new("Motor6D")
  23. LeftLeg1.Parent = Torso
  24. LeftLeg1.Part0 = Torso
  25. LeftLeg1.Part1 = LeftLeg
  26. RightLeg = Instance.new("Part", Humanoid)
  27. RightLeg.Size = Vector3.new(1,2,1)
  28. RightLeg1 = Instance.new("Motor6D")
  29. RightLeg1.Parent = Torso
  30. RightLeg1.Part0 = Torso
  31. RightLeg1.Part1 = RightLeg
  32. Head = Instance.new("Part", Humanoid)
  33. Head.Size = Vector3.new(1,1,1)
  34. Neck = Instance.new("Motor6D")
  35. Neck.Parent = Torso
  36. Neck.Part0 = Torso
  37. Neck.Part1 = Head
  38. RightLeg.Position = Vector3.new(0.5,0,0)
  39. LeftLeg.Position = Vector3.new(-0.5,0,0)
  40. Torso.Position = Vector3.new(0,2,0)
  41. HumanoidRootPart.Position = Vector3.new(0,2,0)
  42. Head.Position = Vector3.new(0,3.5,0)
  43. RightArm.Position = Vector3.new(1.5,2,0)
  44. LeftArm.Position = Vector3.new(-1.5,2,0)
  45. HumanoidRootPart1 = Instance.new("Weld")
  46. HumanoidRootPart1.Parent = HumanoidRootPart
  47. HumanoidRootPart1.Part0 = HumanoidRootPart
  48. HumanoidRootPart1.Part1 = Torso
  49. HumanoidRootPart1.part1 = Torso
  50. HumanoidRootPart.Name = "HumanoidRootPart"
  51. Humanoid.PrimaryPart = owner.Character.HumanoidRootPart
  52. part1 = HumanoidRootPart
  53. local bg = Instance.new("BodyGyro",part1)
  54. bg.D = 100
  55. bg.P = 100000
  56. bg.MaxTorque = Vector3.new(1000000,1000000,1000000)
  57. local velocitylol = Instance.new("BodyVelocity", part1)
  58. coroutine.wrap(function()
  59. while true do
  60. task.wait()
  61. velocitylol.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  62. velocitylol.Velocity = part1.CFrame.LookVector * -32
  63. end
  64. end)()
  65. function move(target)
  66. local dir = (part1.Position - target.Position).unit
  67. local spawnPos = part1.Position
  68. local pos = spawnPos + (dir * 1)
  69. bg.cframe = CFrame.new(pos, pos + dir)
  70. end
  71.  
  72. function findNearestTorso(pos)
  73. local list = game.Workspace:GetChildren()
  74. local torso = nil
  75. local dist = 1000
  76. local temp = nil
  77. local human = nil
  78. local temp2 = nil
  79. for x = 1, #list do
  80. temp2 = list[x]
  81. if (temp2.className == "Model") and (temp2 ~= script.Parent) then
  82. temp = temp2:findFirstChild("Head")
  83. human = temp2:findFirstChild("Humanoid")
  84. if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
  85. if (temp.Position - pos).magnitude < dist then
  86. torso = temp
  87. dist = (temp.Position - pos).magnitude
  88. end
  89. end
  90. end
  91. end
  92. return torso
  93. end
  94. while true do
  95. local torso = findNearestTorso(part1.Position)
  96. if torso~=nil then
  97. move(torso)
  98. end
  99. task.wait()
  100. end
Add Comment
Please, Sign In to add comment