Advertisement
billwa

Molotov Cocktail

Oct 23rd, 2015
601
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.62 KB | None | 0 0
  1. molotov = Instance.new("Tool",game.Players.LocalPlayer.Backpack)
  2. molotov.GripPos = Vector3.new(0,-0.20000000298023,0)
  3. molotov.Grip = CFrame.new(0,-0.20000000298023,0) * CFrame.Angles(-0.19739556312561, -1.2431163787842, -0)
  4. molotov.GripForward = Vector3.new(0.9467915892601,-0.063119441270828,-0.31559720635414)
  5. molotov.Name = "Molotov"
  6. molotov.GripRight = Vector3.new(0.32184725999832,0.18568110466003,0.92840552330017)
  7. molotov.GripUp = Vector3.new(0,0.98058068752289,-0.19611613452435)
  8.  
  9. handle = Instance.new("Part",molotov)
  10. handle.FormFactor = Enum.FormFactor.Symmetric
  11. handle.TopSurface = Enum.SurfaceType.Smooth
  12. handle.Size = Vector3.new(1,1,1)
  13. handle.Name = "Handle"
  14. handle.CFrame = CFrame.new(18.502923965454,0.48202115297318,-21.500253677368) * CFrame.Angles(1.5719887018204, 1.5650086402893, -1.5725026130676)
  15. handle.BrickColor = BrickColor.new("Brown")
  16. handle.Friction = 0.30000001192093
  17. handle.BottomSurface = Enum.SurfaceType.Smooth
  18.  
  19. fire = Instance.new("Sound",handle)
  20. fire.Name = "Fire"
  21. fire.SoundId = "rbxasset://sounds//swoosh.wav"
  22.  
  23. mesh = Instance.new("SpecialMesh",handle)
  24. mesh.MeshId = "http://www.roblox.com/asset/?id=29690481"
  25. mesh.TextureId = "http://www.roblox.com/asset/?id=35971961"
  26. mesh.MeshType = Enum.MeshType.FileMesh
  27.  
  28. fire = Instance.new("Fire",handle)
  29. fire.Heat = 10
  30. fire.Color = Color3.new(1, 0.521569, 0)
  31. fire.SecondaryColor = Color3.new(1, 0, 0)
  32. fire.Size = 2
  33.  
  34. firemesh = Instance.new("SpecialMesh",molotov)
  35. firemesh.Scale = Vector3.new(0.10000000149012,0.050000000745058,0.10000000149012)
  36. firemesh.VertexColor = Vector3.new(2,2,2)
  37. firemesh.Name = "FireMesh"
  38. firemesh.MeshType = Enum.MeshType.FileMesh
  39.  
  40. local prev
  41. local parts = molotov:GetChildren()
  42.  
  43. for i = 1,#parts do
  44.         if (parts[i].className == "Part") then
  45.                 if (prev ~= nil)then
  46.                         local weld = Instance.new("Weld")
  47.                         weld.Part0 = prev
  48.                         weld.Part1 = parts[i]
  49.                         weld.C0 = prev.CFrame:inverse()
  50.                         weld.C1 = parts[i].CFrame:inverse()
  51.                         weld.Parent = prev
  52.                 end
  53.                 prev = parts[i]
  54.         end
  55. end
  56.  
  57. Tool = molotov
  58.  
  59. function fire(v)
  60.     Tool.Handle.Fire:play()
  61.     local vCharacter = Tool.Parent
  62.     local vPlayer = game.Players:playerFromCharacter(vCharacter)
  63.     local missile = Instance.new("Part")
  64.     local spawnPos = vCharacter.PrimaryPart.Position
  65.     Tool.GripPos = Vector3.new(0, 0.4, 0.5)
  66.     vCharacter.Torso["Right Shoulder"].CurrentAngle = 3
  67.     spawnPos  = spawnPos + (v * 8)
  68.     missile.Position = spawnPos
  69.     missile.Size = Vector3.new(1,1,1)
  70.     missile.Velocity = v * 50
  71.     missile.BrickColor = BrickColor.new("Brown")
  72.     local force = Instance.new("BodyForce")
  73.     force.force = Vector3.new(0,100,0)
  74.     force.Parent = missile
  75.     Tool.Handle.Mesh:clone().Parent = missile
  76.     missile.Parent = game.Workspace
  77.  
  78.     missile.Touched:connect(function() -- Make a function and call it too.
  79. ex = Instance.new("Explosion") -- Make explosion.
  80. ex.Position = missile.Position -- Move it to brick.
  81. ex.Parent = game.Workspace -- Make sure it's tangible!
  82. ex.BlastRadius = 4 -- Size of explosion.
  83. ex.BlastPressure = 5e+005 -- Power of it.
  84. end)
  85. end
  86.  
  87.  
  88.  
  89.  
  90. Tool.Enabled = true
  91. function onActivated()
  92.     if not Tool.Enabled then
  93.         return
  94.     end
  95.     Tool.Enabled = false
  96.     local character = Tool.Parent;
  97.     local humanoid = character.Humanoid
  98.     if humanoid == nil then
  99.         print("Humanoid not found")
  100.         return
  101.     end
  102.     local targetPos = humanoid.TargetPoint
  103.     local lookAt = (targetPos - character.Head.Position).unit
  104.     fire(lookAt)
  105.     wait(0.1)
  106.     Tool.Parent = nil
  107. end
  108.  
  109. molotov.Activated:connect(onActivated)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement