Advertisement
ViggoCS

Realistic_Gun

Aug 8th, 2017
11,374
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.24 KB | None | 0 0
  1. player = game:service("Players").LocalPlayer
  2. workspace = game:service("Workspace")
  3. char = player.Character
  4. mouse = player:GetMouse()
  5. equip = false
  6. cooldown = true
  7. aim = false
  8. ammo = 7
  9. reload = true
  10. rootpart = char:FindFirstChild("HumanoidRootPart")
  11. body = ""
  12. local bg = Instance.new("BodyGyro", script)
  13. bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  14. bg.P = 10000
  15. bg.D = 100
  16. if char:FindFirstChild("Torso") then
  17. body = char.Torso
  18. elseif char:FindFirstChild("UpperTorso") then
  19. body = char.UpperTorso
  20. end
  21. function blood(parent)
  22. local blood = Instance.new("ParticleEmitter", parent)
  23. blood.Color = ColorSequence.new(Color3.new(1, 0, 0), Color3.new(0.5, 0, 0))
  24. blood.LightEmission = 0.1
  25. blood.Size = NumberSequence.new(0.07)
  26. blood.Texture = "http://www.roblox.com/asset/?ID=771221224"
  27. blood1 = NumberSequence.new({
  28. NumberSequenceKeypoint.new(0, 0.2),
  29. NumberSequenceKeypoint.new(1, 5)
  30. })
  31. blood2 = NumberSequence.new({
  32. NumberSequenceKeypoint.new(0, 1),
  33. NumberSequenceKeypoint.new(0.0636, 0),
  34. NumberSequenceKeypoint.new(1, 1)
  35. })
  36. blood.Transparency = blood2
  37. blood.Size = blood1
  38. blood.ZOffset = 0.9
  39. blood.Acceleration = Vector3.new(0, -2, 0)
  40. blood.LockedToPart = false
  41. blood.EmissionDirection = "Top"
  42. blood.Lifetime = NumberRange.new(0.5, 0.6)
  43. blood.Rate = 1000
  44. blood.Rotation = NumberRange.new(-100, 100)
  45. blood.RotSpeed = NumberRange.new(-100, 100)
  46. blood.Speed = NumberRange.new(10)
  47. blood.VelocitySpread = 30
  48. blood.Enabled = true
  49. wait(0.03)
  50. blood.Enabled = false
  51. end
  52. t1 = Instance.new("Tool", player.Backpack)
  53. t1.GripUp = Vector3.new(0, 0, 1)
  54. t1.GripPos = Vector3.new(0, -0.2, -0.5)
  55. t1.Name = ""
  56. p1 = Instance.new("Part", t1)
  57. p1.BrickColor = BrickColor.new("Black")
  58. p1.Name = "Handle"
  59. p1.CFrame = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(5), math.rad(5), math.rad(5))
  60. p1.Size = Vector3.new(0.2, 1.2, 0.7)
  61. p1.BottomSurface = Enum.SurfaceType.Smooth
  62. p1.TopSurface = Enum.SurfaceType.Smooth
  63. b1 = Instance.new("SpecialMesh", p1)
  64. b1.MeshId = "http://www.roblox.com/asset/?id=72012879"
  65. b1.TextureId = "http://www.roblox.com/asset/?id=150098265"
  66. b1.MeshType = Enum.MeshType.FileMesh
  67. b1.Name = "Mesh"
  68. b1.Offset = Vector3.new(0, 0.300000012, -0.150000006)
  69. b1.Scale = Vector3.new(2, 1.5, 1.25)
  70. p2 = Instance.new("Part", t1)
  71. p2.BrickColor = BrickColor.new("Black")
  72. p2.Transparency = 1
  73. p2.Name = "Main"
  74. p2.CFrame = CFrame.new(-9.07499886, 4.39000416, -19.8000011, 1, 2.22369144E-5, 1.3722377E-8, -2.22369144E-5, 1, -1.43634118E-8, -1.37226968E-8, 1.43631063E-8, 1)
  75. p2.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
  76. p2.BottomSurface = Enum.SurfaceType.Smooth
  77. p2.TopSurface = Enum.SurfaceType.Smooth
  78. Weld = Instance.new("Weld", char)
  79. Weld.Part0 = p1
  80. Weld.Part1 = p2
  81. Weld.C1 = CFrame.new(0, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
  82. function fx()
  83. local blood = Instance.new("ParticleEmitter", p1)
  84. blood.Color = ColorSequence.new(Color3.new(255, 255, 255), Color3.new(255, 255, 255))
  85. blood.LightEmission = 0.1
  86. blood.Size = NumberSequence.new(0, 0, 0)
  87. blood.Texture = "http://www.roblox.com/asset/?id=242995654"
  88. blood1 = NumberSequence.new({
  89. NumberSequenceKeypoint.new(0, 0.2),
  90. NumberSequenceKeypoint.new(1, 5)
  91. })
  92. blood2 = NumberSequence.new({
  93. NumberSequenceKeypoint.new(0, 1),
  94. NumberSequenceKeypoint.new(0.0636, 0),
  95. NumberSequenceKeypoint.new(1, 1)
  96. })
  97. blood.Transparency = blood2
  98. blood.Size = blood1
  99. blood.ZOffset = 0.9
  100. blood.Acceleration = Vector3.new(0, -2, 0)
  101. blood.LockedToPart = true
  102. blood.EmissionDirection = "Top"
  103. blood.Lifetime = NumberRange.new(0.1, 0.1)
  104. blood.Rate = 100
  105. blood.Rotation = NumberRange.new(-100, 100)
  106. blood.RotSpeed = NumberRange.new(-100, 100)
  107. blood.Speed = NumberRange.new(10)
  108. blood.VelocitySpread = 30
  109. blood.Enabled = true
  110. wait(0.03)
  111. blood:Destroy()
  112. end
  113. Tool = t1
  114. local arms, torso
  115. local welds = {}
  116. function Equip(mouse)
  117. bg.Parent = rootpart
  118. aim = true
  119. wait(0.01)
  120. arms = {
  121. Tool.Parent:FindFirstChild("Left Arm"),
  122. Tool.Parent:FindFirstChild("Right Arm")
  123. }
  124. torso = Tool.Parent:FindFirstChild("Torso")
  125. if arms ~= nil and torso ~= nil then
  126. local sh = {
  127. torso:FindFirstChild("Left Shoulder"),
  128. torso:FindFirstChild("Right Shoulder")
  129. }
  130. if sh ~= nil then
  131. local yes = true
  132. if yes then
  133. yes = false
  134. sh[1].Part1 = nil
  135. sh[2].Part1 = nil
  136. local weld1 = Instance.new("Weld")
  137. weld1.Part0 = torso
  138. weld1.Parent = torso
  139. weld1.Part1 = arms[1]
  140. weld1.C1 = CFrame.new(-0.249, 0.1, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(320), 0, math.rad(-90))
  141. welds[1] = weld1
  142. local weld2 = Instance.new("Weld")
  143. weld2.Part0 = torso
  144. weld2.Parent = torso
  145. weld2.Part1 = arms[2]
  146. weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  147. welds[2] = weld2
  148. end
  149. else
  150. print("sh")
  151. end
  152. else
  153. print("arms")
  154. end
  155. end
  156. function Unequip(mouse)
  157. bg.Parent = script
  158. aim = false
  159. if arms ~= nil and torso ~= nil then
  160. local sh = {
  161. torso:FindFirstChild("Left Shoulder"),
  162. torso:FindFirstChild("Right Shoulder")
  163. }
  164. if sh ~= nil then
  165. local yes = true
  166. if yes then
  167. yes = false
  168. sh[1].Part1 = arms[1]
  169. sh[2].Part1 = arms[2]
  170. welds[1].Parent = nil
  171. welds[2].Parent = nil
  172. end
  173. else
  174. print("sh")
  175. end
  176. else
  177. print("arms")
  178. end
  179. end
  180. Tool.Equipped:connect(Equip)
  181. Tool.Unequipped:connect(Unequip)
  182. local tool = t1
  183. tool.Equipped:connect(function(mouse)
  184. equip = true
  185. mouse.Button1Down:connect(function()
  186. if reload then
  187. ammo = ammo - 1
  188. body.CFrame = CFrame.new(body.Position, mouse.Hit.p)
  189. sou = Instance.new("Sound", p1)
  190. sou.Volume = 2
  191. sou.SoundId = "rbxassetid://930650202"
  192. sou:Play()
  193. fx()
  194. if mouse.Target.Parent:FindFirstChildOfClass("Humanoid") then
  195. if mouse.Target.Parent.Humanoid.Health ~= 0 then
  196. local target = mouse.Target
  197. blood(target)
  198. sou = Instance.new("Sound", target)
  199. sou.Volume = 1.3
  200. sou.SoundId = "rbxassetid://144884872"
  201. sou:Play()
  202. target.Parent.Humanoid:TakeDamage(math.random(target.Parent.Humanoid.MaxHealth / 2 / 3, target.Parent.Humanoid.MaxHealth / 2 / 2))
  203. elseif mouse.Target.Parent:FindFirstChildOfClass("Humanoid") and mouse.Target.Parent:FindFirstChild("Head") then
  204. local target = mouse.Target
  205. target.Parent:BreakJoints()
  206. local bv = Instance.new("BodyVelocity")
  207. bv.maxForce = Vector3.new(1000000000, 1000000000, 1000000000)
  208. bv.velocity = mouse.Hit.lookVector * 45
  209. bv.Parent = target.Parent.Head
  210. end
  211. end
  212. end
  213. end)
  214. end)
  215. while wait() do
  216. if ammo == 0 and reload then
  217. reload = false
  218. sou = Instance.new("Sound", p1)
  219. sou.Volume = 1.3
  220. sou.SoundId = "rbxassetid://174295321"
  221. sou:Play()
  222. wait(2)
  223. ammo = 7
  224. reload = true
  225. end
  226. if aim then
  227. bg.cframe = CFrame.new(rootpart.Position, mouse.Hit.p * Vector3.new(1, 0, 1) + rootpart.Position * Vector3.new(0, 1, 0))
  228. end
  229. end
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement