Mryeetmemes

RocketBlast

Dec 9th, 2021
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.32 KB | None | 0 0
  1. r = game:service("RunService")
  2.  
  3.  
  4.  
  5.  
  6.  
  7. shaft = script.Parent
  8.  
  9.  
  10.  
  11.    
  12.  
  13.        
  14.  
  15.  
  16.  
  17.  
  18. position = shaft.Position
  19.  
  20.  
  21.  
  22.  
  23.  
  24. script.Parent.Explosion.PlayOnRemove = true -- play explosion sound when projectile removed from game
  25.  
  26.  
  27.  
  28.  
  29.  
  30. function fly()
  31.  
  32.  
  33.     direction = shaft.CFrame.lookVector --error here
  34.  
  35.  
  36.     position = position  + direction * 10
  37.  
  38.  
  39.     error = position - shaft.Position -- error here
  40.  
  41.  
  42.     shaft.Velocity = 7*error
  43.  
  44.  
  45. end
  46.  
  47.  
  48.  
  49.  
  50.  
  51. function blow()
  52.  
  53.  
  54.     swoosh:stop()
  55.  
  56.  
  57.     explosion = Instance.new("Explosion") --error here
  58.  
  59.  
  60.     explosion.Position = shaft.Position
  61.  
  62.  
  63.  
  64.  
  65.  
  66. ---OMG HAX PART!
  67. m = Instance.new("Model") --error here
  68. m.Parent = game.Workspace
  69. m.Name = "MushroomCloud"
  70. script.Parent.Anchored = true
  71. script.Parent.Transparency = 1
  72. script.Parent.Fire.Enabled = false
  73. script.Parent.Parent = m
  74. b = script.Blast:Clone() --error here
  75. b.Parent = script.Parent
  76. b.Disabled = false
  77. script.Disabled = true
  78.  
  79. ---------------------------------------------
  80.  
  81.  
  82.  
  83.     -- find instigator tag
  84.  
  85.  
  86.     local creator = script.Parent:findFirstChild("creator")
  87.  
  88.  
  89.     if creator ~= nil then
  90.  
  91.  
  92.         explosion.Hit:connect(function(part, distance)  onPlayerBlownUp(part, distance, creator) end)
  93.  
  94.  
  95.     end
  96.  
  97.  
  98.  
  99.  
  100.  
  101.     explosion.Parent = game.Workspace
  102.  
  103.  
  104.     connection:disconnect()
  105.  
  106.  
  107.  
  108.  
  109.  
  110. end
  111.  
  112.  
  113.  
  114.  
  115.  
  116. function onPlayerBlownUp(part, distance, creator)
  117.  
  118.  
  119.    
  120.  
  121.  
  122.     if part.Name == "Head" then
  123.  
  124.  
  125.    
  126.  
  127.  
  128.         local humanoid = part.Parent.Humanoid
  129.  
  130.  
  131.         tagHumanoid(humanoid, creator)
  132.  
  133.  
  134.     end
  135.  
  136.  
  137. end
  138.  
  139.  
  140.  
  141.  
  142.  
  143. function tagHumanoid(humanoid, creator)
  144.  
  145.  
  146.     -- tag does not need to expire iff all explosions lethal
  147.  
  148.  
  149.    
  150.  
  151.  
  152.     if creator ~= nil then
  153.  
  154.  
  155.         local new_tag = creator:clone()
  156.  
  157.  
  158.         new_tag.Parent = humanoid
  159.  
  160.  
  161.        
  162.  
  163.  
  164.     end
  165.  
  166.  
  167. end
  168.  
  169.  
  170.  
  171.  
  172.  
  173. function untagHumanoid(humanoid)
  174.  
  175.  
  176.     if humanoid ~= nil then
  177.  
  178.  
  179.         local tag = humanoid:findFirstChild("creator")
  180.  
  181.  
  182.         if tag ~= nil then
  183.  
  184.  
  185.        
  186.  
  187.  
  188.             tag.Parent = nil
  189.  
  190.  
  191.         end
  192.  
  193.  
  194.     end
  195.  
  196.  
  197. end
  198.  
  199.  
  200.  
  201.  
  202.  
  203. t, s = r.Stepped:wait()
  204.  
  205.  
  206.  
  207.  
  208.  
  209. swoosh = script.Parent.Swoosh
  210.  
  211.  
  212. swoosh:play()
  213.  
  214.  
  215.  
  216.  
  217.  
  218. d = t + 10.0 - s
  219.  
  220.  
  221. connection = shaft.Touched:connect(blow)
  222.  
  223.  
  224.  
  225.  
  226.  
  227. while t < d do
  228.  
  229.  
  230.     fly()
  231.  
  232.  
  233.     t = r.Stepped:wait()
  234.  
  235.  
  236. end
  237.  
  238.  
  239.  
  240.  
  241.  
  242. -- at max range
  243. wait(60)
  244.  
  245. script.Parent.Explosion.PlayOnRemove = false
  246.  
  247.  
  248. swoosh:stop()
  249.  
  250.  
  251. shaft:remove()
  252.  
  253.  
  254.  
Advertisement
Add Comment
Please, Sign In to add comment