Advertisement
TheUnknownDiscord

Maro

Feb 9th, 2022 (edited)
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. e = Instance.new("RemoteEvent",owner.Character)
  2. e.Name = "The"
  3. t = 1
  4. e.OnServerEvent:Connect(function(_,hit)
  5. local g = Vector3.new(0, -game.Workspace.Gravity, 0);
  6. local x0 = owner.Character.HumanoidRootPart.CFrame * Vector3.new(0, 2, -2)
  7. local v0 = (hit - x0 - 0.5*g*t*t)/t;
  8.  
  9. local c = Instance.new("Part");
  10. c.CanCollide = true;
  11. c.Size = Vector3.new(5.025, 5.765,6.155)
  12. c.Shape = "Ball"
  13. c.CFrame = CFrame.new(x0)
  14. c.Velocity = v0
  15. local density = c:GetMass()
  16. local friction = 1
  17. local elasticity = 0.25
  18. local frictionWeight = 10000
  19. local elasticityWeight = 10000
  20. local physProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
  21. c.CustomPhysicalProperties = physProperties
  22. c.Parent = script
  23. local a = Instance.new("Sound",c)
  24. a.SoundId = "http://www.roblox.com/asset/?id=2320685801"
  25. a.Volume = 0.5
  26. a.Looped = true
  27. a:Play()
  28. local Mesh = Instance.new("SpecialMesh")
  29. Mesh.Parent = c
  30. Mesh.MeshId = "http://www.roblox.com/asset/?id=849882710"
  31. Mesh.TextureId = "http://www.roblox.com/asset/?id=849882719"
  32. local function move(target)
  33. local dir = (target.Position - c.Position).unit
  34. local spawnPos = c.Position
  35. local pos = spawnPos + (dir * 1)
  36. c:ApplyImpulse(CFrame.new(pos, pos + dir).lookVector * -1000)
  37. end
  38.  
  39. local function findNearestTorso(pos)
  40. local list = game.Workspace:GetChildren()
  41. local torso = nil
  42. local dist = 40
  43. local temp = nil
  44. local human = nil
  45. local temp2 = nil
  46. for x = 1, #list do
  47. coroutine.wrap(function()
  48. temp2 = list[x]
  49. if (temp2.className == "Model") then
  50. temp = temp2:findFirstChild("Head")
  51. human = temp2:findFirstChild("Humanoid")
  52. if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
  53. if (temp.Position - pos).magnitude < dist then
  54. torso = temp
  55. dist = (temp.Position - pos).magnitude
  56. end
  57. end
  58. end
  59. end)()
  60. end
  61. return torso
  62. end
  63. coroutine.wrap(function()
  64. while true do
  65. local torso = findNearestTorso(c.Position)
  66. if torso~=nil or c.Velocity.Y < -0.5 then
  67. a.SoundId = "http://www.roblox.com/asset/?id=2320685801"
  68. if torso ~= nil then
  69. move(torso)
  70. end
  71. else
  72. a.SoundId = "http://www.roblox.com/asset/?id=6524411621"
  73. c:ApplyImpulse(CFrame.new(c.Position,c.Position + c.Velocity).lookVector * -1000)
  74. end
  75. task.wait()
  76. end
  77. end)()
  78. end)
  79. NLS([[
  80. e = owner.Character:WaitForChild("The")
  81. mouse = owner:GetMouse()
  82. owner:GetMouse().Button1Down:Connect(function()
  83. e:FireServer(mouse.Hit.p)
  84. end)
  85. ]],owner.PlayerGui)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement