Advertisement
TheUnknownDiscord

minigun

May 16th, 2022 (edited)
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.20 KB | None | 0 0
  1. local fire = "10209776"
  2. local dry = "10209771"
  3. local down = "10209788"
  4. local up = "10209786"
  5. local rev = "7127177877"
  6. local tool = Instance.new("Tool",owner.Backpack)
  7. part2 = Instance.new("Part",tool)
  8. part2.Name = "Handle"
  9. part2.Size = Vector3.new(0.1,0.1,0.1)
  10. part2.Transparency = 1
  11. part = Instance.new("Part",part2)
  12. part.Size = Vector3.new(2,5.4,3.2)
  13. part.Massless = true
  14. part.CanCollide = false
  15. local weld = Instance.new("Weld",part2)
  16. weld.Part0 = part
  17. weld.Part1 = part2
  18. weld.C1 = CFrame.new(0.25,-0.25,-0.25) * CFrame.Angles(0,math.rad(180),0)
  19. weld.C0 = CFrame.new(0,-2,-0.5)
  20. local mesh = Instance.new("SpecialMesh",part)
  21. mesh.MeshId = "rbxassetid://7805077723"
  22. mesh.TextureId = "rbxassetid://7805076584"
  23. local tweenService = game:GetService("TweenService")
  24. local timeToFade = 0.35
  25. local object = weld
  26. local tweenInfo = TweenInfo.new(timeToFade,Enum.EasingStyle.Quint,Enum.EasingDirection.Out)
  27. local goal = {}
  28. goal.C0 = CFrame.new(0,-2,-0.5) * CFrame.Angles(math.rad(-90),0,0)
  29.  
  30. local tween = tweenService:Create(object, tweenInfo, goal)
  31. local tweenInfo2 = TweenInfo.new(timeToFade,Enum.EasingStyle.Quad,Enum.EasingDirection.Out)
  32. local goal2 = {}
  33. goal2.C0 = CFrame.new(0,-2,-0.5) * CFrame.Angles(math.rad(0),0,0)
  34.  
  35. local tween2 = tweenService:Create(object, tweenInfo2, goal2)
  36. local sound = Instance.new("Sound",part)
  37. sound.Volume = 0.35
  38. revving = false
  39. tool.Activated:Connect(function()
  40. tween2:Cancel()
  41. tween:Play()
  42. sound.Looped = false
  43. sound.TimePosition = 0
  44. sound.SoundId = "rbxassetid://"..down
  45. sound:Play()
  46. revving = true
  47. owner.Character.Humanoid.WalkSpeed = 8
  48. end)
  49. firing = false
  50. tool.Deactivated:Connect(function()
  51. tween:Cancel()
  52. tween2:Play()
  53. sound:Stop()
  54. sound.Looped = false
  55. sound.TimePosition = 0.1
  56. sound.SoundId = "rbxassetid://"..up
  57. sound:Play()
  58. firing = false
  59. revving = false
  60. owner.Character.Humanoid.WalkSpeed = 16
  61. end)
  62. sound.Ended:Connect(function()
  63. if (sound.SoundId == "rbxassetid://"..down or sound.SoundId == "rbxassetid://"..fire) then
  64. sound.Looped = true
  65. sound.TimePosition = 0
  66. sound.SoundId = "rbxassetid://"..fire
  67. firing = true
  68. sound:Play()
  69. end
  70. end)
  71. e = Instance.new("RemoteEvent",owner.Character)
  72. e.OnServerEvent:Connect(function(_,zoomed,cf)
  73. if zoomed == true and revving then
  74. local lookvector = owner.Character.Torso.CFrame:toObjectSpace(cf).lookVector.unit
  75. tool.Grip = tool.Grip:Lerp(CFrame.Angles(math.sin(-lookvector.y),0,0),0.3)
  76. else
  77. tool.Grip = tool.Grip:Lerp(CFrame.Angles(math.sin(0),0,0),0.3)
  78. end
  79. end)
  80. NLS([[
  81. e = script.Parent
  82. game:GetService("RunService").RenderStepped:Connect(function()
  83. if (workspace.CurrentCamera.CFrame.Position - owner.Character.Head.Position).Magnitude <= 0.75 then
  84. e:FireServer(true,workspace.CurrentCamera.CFrame)
  85. else
  86. e:FireServer(false)
  87. end
  88. end)
  89. ]],e)
  90. local hit = Instance.new("Sound")
  91. hit.PlayOnRemove = true
  92. hit.Volume = 0.75
  93. while task.wait() do
  94. if firing then
  95. wait(0.0625)
  96. part:ApplyImpulse(part.CFrame.upVector * -5)
  97. local Flame3 = Instance.new("SpawnLocation", script)
  98. Flame3.Size = Vector3.new(0.5,0.5,0.5)
  99. Flame3.Neutral = false
  100. Flame3.Enabled = false
  101. Flame3.CFrame = part.CFrame * CFrame.new(0.25,2.7,-0.5)
  102. Flame3.Position = Flame3.Position + (part.Velocity * 2) * owner:GetNetworkPing()
  103. Flame3.CanCollide = false
  104. Flame3.CanTouch = false
  105. Flame3.Color = Color3.fromRGB(255, 50, 50)
  106. Flame3.Material = "Neon"
  107. Flame3.Anchored = true
  108. Flame3.Name = "Flameslol"
  109. local timeToFade6
  110. if part.Velocity ~= Vector3.new(0,0,0) then
  111. timeToFade6 = (Flame3.Position - (Flame3.Position + (part.Velocity * 2) * owner:GetNetworkPing())).Magnitude * 0.25
  112. game:GetService("Debris"):AddItem(Flame3,(Flame3.Position - (Flame3.Position + (part.Velocity * 2) * owner:GetNetworkPing())).Magnitude * 0.25)
  113. else
  114. timeToFade6 = 0.25
  115. game:GetService("Debris"):AddItem(Flame3,0.25)
  116. end
  117. local object6 = Flame3
  118. local tweenInfo6 = TweenInfo.new(timeToFade6,Enum.EasingStyle.Cubic,Enum.EasingDirection.Out)
  119. local tweenInfo5 = TweenInfo.new(timeToFade6 * 0.79)
  120. local goal10 = {}
  121. goal10.CFrame = CFrame.new(Flame3.Position + (part.Velocity * 2) * owner:GetNetworkPing()) * CFrame.Angles(Flame3.CFrame:ToEulerAnglesXYZ()) * CFrame.Angles(math.rad(math.random(-360,360)),math.rad(math.random(-360,360)),math.rad(math.random(-360,360)))
  122. local tween10 = tweenService:Create(object6, tweenInfo6, goal10)
  123. tween10:Play()
  124. local goal11 = {}
  125. goal11.Transparency = 1
  126. goal11.Color = Color3.fromRGB(255, 155, 0)
  127. local tween11 = tweenService:Create(object6, tweenInfo5, goal11)
  128. tween11:Play()
  129. local s = Instance.new("SpawnLocation",script)
  130. s.Enabled = false
  131. s.CFrame = part.CFrame * CFrame.new(-0.25 + Random.new():NextNumber(-0.125,0.125),4,-0.5 + Random.new():NextNumber(-0.125,0.125)) * CFrame.Angles(math.rad(-90),math.rad(180),0)
  132. if part.Velocity ~= Vector3.new(0,0,0) then
  133. s.Position = s.Position + (part.Velocity * 2) * owner:GetNetworkPing()
  134. end
  135. s.Size = Vector3.new(0.812145,1.03994,0.8652875)
  136. local m = Instance.new("SpecialMesh",s)
  137. m.MeshId = "rbxassetid://5204380553"
  138. m.TextureId = "rbxassetid://5204380894"
  139. m.Scale = Vector3.new(0.0725,0.0725,0.0725)
  140. local tw = TweenInfo.new(0.125,Enum.EasingStyle.Quint,Enum.EasingDirection.In)
  141. local g = {}
  142. g.Size = Vector3.new(0.812145,1.03994,0.8652875) * 3
  143. local t = tweenService:Create(s, tw, g)
  144. t:Play()
  145. local g2 = {}
  146. g2.Scale = Vector3.new(0.0725,0.0725,0.0725) * 3
  147. local t2 = tweenService:Create(m, tw, g2)
  148. t2:Play()
  149. game:GetService("Debris"):AddItem(s,2)
  150. local ya = Instance.new("Sound",s)
  151. ya.Volume = 2
  152. ya.SoundId = "rbxassetid://5291644593"
  153. ya.Looped = true
  154. ya:Play()
  155. s.Touched:Connect(function(wha)
  156. if wha:FindFirstAncestorWhichIsA("Model") and wha:FindFirstAncestorWhichIsA("Model"):FindFirstChildWhichIsA("Humanoid") then
  157. if wha:FindFirstAncestorWhichIsA("Model"):FindFirstChildWhichIsA("Humanoid") ~= owner.Character.Humanoid then
  158. wha:FindFirstAncestorWhichIsA("Model"):FindFirstChildWhichIsA("Humanoid").Health -= 5
  159. if wha:FindFirstAncestorWhichIsA("Model"):FindFirstChildWhichIsA("Humanoid").Health > 0 then
  160. hit.Parent = part
  161. hit.SoundId = "rbxassetid://2868331684"
  162. hit.Parent = nil
  163. else
  164. hit.Parent = part
  165. hit.SoundId = "rbxassetid://2866718318"
  166. hit.Parent = nil
  167. end
  168. s:Destroy()
  169. end
  170. end
  171. end)
  172. s:ApplyImpulse(part.CFrame.upVector * 750 * s:GetMass() + Vector3.new(0,s:GetMass(),0))
  173. end
  174. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement