Advertisement
Coryh

Untitled

Mar 6th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. -- By Dominical -- Script Builder -- Local Script -- V 5.0 --
  2.  
  3. PlayerName = "corymegatron" -- Put your name here then run as local script
  4.  
  5. player=game.Players[PlayerName]
  6. character=player
  7. PlayerMouse=player:GetMouse()--returns player mouse
  8. bullet_speed=300--constant value
  9.  
  10. local gun=Instance.new("Tool")
  11. local gun_handle=Instance.new("Part")
  12. local handle_mesh=Instance.new("FileMesh")
  13. gun.Parent=player.Backpack
  14. gun.Name="Grenade Launcher"
  15. gun.TextureId="http://www.roblox.com/asset?id=73566284"
  16. gun_handle.Parent=gun
  17. gun_handle.Name="Handle"
  18. gun_handle.Size=Vector3.new(0.2, 1.7, 1.4)
  19. handle_mesh.Parent=gun_handle
  20. handle_mesh.MeshId="http://www.roblox.com/asset?id=19361608"
  21. handle_mesh.TextureId="http://www.roblox.com/asset?id=41827574"
  22. handle_mesh.VertexColor=Vector3.new(2,2,2)--yes this is a vector value
  23. handle_mesh.Scale=Vector3.new(0.5, 0.5, 0.5)
  24. gun.GripForward=Vector3.new(0, 1, 0)
  25. gun.GripPos=Vector3.new(0, -0.3, -1)
  26. gun.GripUp=Vector3.new(0, 0, 1)
  27. gun.GripRight=Vector3.new(0, 0, 0)--bug fix(done)
  28.  
  29. gun.Activated:connect(function()
  30. local bullet=Instance.new("Part")
  31. local bullet_mesh=Instance.new("SpecialMesh")
  32. local shot_sound=Instance.new("Sound")
  33. local impact_sound=Instance.new("Sound")
  34. bullet_mesh.MeshType="FileMesh"
  35. bullet.Size=Vector3.new(2,2,2)
  36. bullet.Parent=workspace
  37. bullet.Name="Bullet"
  38. bullet.TopSurface="Smooth"
  39. bullet.BottomSurface='Smooth'
  40. bullet.BrickColor=BrickColor.new("Bright yellow")
  41. bullet_mesh.MeshId="http://www.roblox.com/asset/?id=94691640"
  42. bullet_mesh.TextureId="http://www.roblox.com/asset/?id=94691681"
  43. bullet_mesh.Scale=Vector3.new(2,2,2)
  44. bullet_mesh.Parent=bullet
  45. impact_sound.Parent=bullet
  46. impact_sound.SoundId="http://www.roblox.com/asset?id=157878578"
  47.  
  48.  
  49.  
  50.  
  51. bullet.CFrame=CFrame.new(gun_handle.CFrame.X,gun_handle.CFrame.Y+3,gun_handle.CFrame.Z)
  52. bullet.Velocity=PlayerMouse.Hit.lookVector*bullet_speed
  53.  
  54.  
  55.  
  56. bullet.Touched:connect(function(hit)
  57. if hit.Parent:findFirstChild("Humanoid") and hit.Parent.Name~=PlayerName then
  58. local explosion=Instance.new("Explosion")
  59. explosion.Parent=workspace
  60. explosion.Position=bullet.Position
  61. hit.Parent:BreakJoints()
  62. impact_sound:Play()
  63. bullet:remove()
  64. else
  65. local explosion=Instance.new("Explosion")
  66. explosion.Parent=workspace
  67. explosion.Position=bullet.Position
  68. impact_sound:Play()
  69. bullet:remove()
  70. end
  71. end)
  72.  
  73. shot_sound.Parent=gun_handle
  74. shot_sound.SoundId="http://www.roblox.com/asset?id=135039581"
  75. shot_sound:Play()
  76. wait(1.5)
  77. shot_sound:remove()
  78.  
  79. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement