Advertisement
fusionfriends

fun gun edited

May 24th, 2020
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.68 KB | None | 0 0
  1. -- Services --
  2. local Players = game:GetService("Players")
  3. local TweenService = game:GetService("TweenService")
  4. -- Variables --
  5. local Player = owner
  6. repeat wait() until Player.Character
  7. local Character = Player.Character
  8. local Tool = Instance.new("Tool",Player.Backpack)
  9. local Gun = Instance.new("Part",Tool)
  10. local GunMesh = Instance.new("SpecialMesh",Gun)
  11. local MousePos
  12. IsFiring = false
  13. Intt = 0
  14. Colors = {
  15. Color3.fromRGB(255,0,0),
  16. Color3.fromRGB(0,255,0),
  17. Color3.fromRGB(0,0,255)
  18. }
  19. ObjectList = {
  20. "ChillHead",
  21. "Plunger",
  22. "Bear",
  23. "Potato",
  24. "Chicken",
  25. "MNM",
  26. "Sans",
  27. "Frog",
  28. "Baguette",
  29. "Duck",
  30. "Mario",
  31. "Squidward"
  32. }
  33. -- Mouse Event --
  34. local MouseEvent = Instance.new("RemoteEvent")
  35. MouseEvent.Name = "MouseEvent"
  36. MouseEvent.Parent = NLS([==[
  37. local Mouse = game:GetService("Players").LocalPlayer:GetMouse()
  38. while wait() do
  39. script.MouseEvent:FireServer(Mouse.Hit.p)
  40. end
  41. ]==],Player.PlayerGui)
  42. MouseEvent.OnServerEvent:Connect(function(Plr,MouseLocation)
  43. if Plr == Player and MouseLocation then
  44. MousePos = MouseLocation
  45. end
  46. end)
  47. -- Functions --
  48. Tool.Equipped:Connect(function()
  49. local Theme = Instance.new("Sound",Gun)
  50. Theme.Looped = true
  51. Theme.Volume = 3
  52. Theme.SoundId = "rbxassetid://413176884"
  53. Theme:Play()
  54. end)
  55. Tool.Unequipped:Connect(function()
  56. for i,v in pairs(Gun:GetChildren()) do
  57. if v:IsA("Sound") then
  58. v:Destroy()
  59. end
  60. end
  61. IsFiring = false
  62. end)
  63. Tool.Activated:Connect(function()
  64. IsFiring = true
  65. local Sound = Instance.new("Sound",Gun)
  66. Sound.Name = "FiringSound"
  67. Sound.Looped = true
  68. Sound.Volume = 3
  69. Sound.SoundId = "rbxassetid://2371488630"
  70. Sound:Play()
  71. end)
  72. Tool.Deactivated:Connect(function()
  73. IsFiring = false
  74. if Gun:FindFirstChild("FiringSound") then
  75. Gun.FiringSound:Destroy()
  76. end
  77. end)
  78. -- Base Code --
  79. Gun.Size = Vector3.new(.5,.5,.5)
  80. Gun.CanCollide = false
  81. Gun.Massless = true
  82. Gun.Locked = true
  83. Gun.Name = "Handle"
  84. GunMesh.Scale = Vector3.new(0.55,0.55,0.55)
  85. GunMesh.MeshId = "rbxassetid://641905504"
  86. GunMesh.Offset = Vector3.new(0,-0.5,2.7)
  87. Tool.TextureId = "http://www.roblox.com/asset/?id=924922390"
  88. Tool.ToolTip = "bbbbblllppplbbb"
  89. Tool.Grip = CFrame.new(0.146357164, -0.69461441, 3.63811111, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  90. -- Loops --
  91. coroutine.resume(coroutine.create(function()
  92. while wait(.5) do
  93. if Intt == #Colors then
  94. Intt = 0
  95. end
  96. Intt = Intt+1
  97. TweenService:Create(Gun,TweenInfo.new(1),{Color = Colors[Intt]}):Play()
  98. end
  99. end))
  100. coroutine.resume(coroutine.create(function()
  101. while wait(.1) do
  102. if IsFiring then
  103. local MuzzleFlash = Instance.new("Part",Gun)
  104. game.Debris:AddItem(MuzzleFlash,.2)
  105. MuzzleFlash.Name = "MuzzleFlash"
  106. MuzzleFlash.CanCollide = false
  107. MuzzleFlash.Material = Enum.Material.Neon
  108. MuzzleFlash.BrickColor = BrickColor.new("New Yeller")
  109. MuzzleFlash.Size = Vector3.new(.25,.25,.25)
  110. MuzzleFlash.CastShadow = false
  111. local MuzzleFlashWeld = Instance.new("Weld",MuzzleFlash)
  112. MuzzleFlashWeld.Part0 = MuzzleFlash
  113. MuzzleFlashWeld.Part1 = Gun
  114. MuzzleFlashWeld.C0 = CFrame.new(0,0,0)*CFrame.Angles(math.rad(math.random(1,360)),math.rad(math.random(1,360)),math.rad(math.random(1,360)))
  115. local MuzzleFlashLight = Instance.new("PointLight",MuzzleFlash)
  116. MuzzleFlashLight.Color = Color3.fromRGB(255,255,0)
  117. TweenService:Create(MuzzleFlash,TweenInfo.new(.2),{Size = Vector3.new(1,1,1);Color = Color3.fromRGB(213,115,61);Transparency = 1}):Play()
  118. local ray = Ray.new(Gun.CFrame.p,(MousePos-Gun.CFrame.p).unit*300)
  119. local IgnoreList = {}
  120. table.insert(IgnoreList,Gun)
  121. for i,v in pairs(Gun:GetDescendants()) do
  122. table.insert(IgnoreList,v)
  123. end
  124. for i,v in pairs(Character:GetDescendants()) do
  125. table.insert(IgnoreList,v)
  126. end
  127. local TargetPart,Pos = workspace:FindPartOnRayWithIgnoreList(ray,IgnoreList)
  128. local Distance = (Gun.CFrame.p - Pos).magnitude
  129. local Beam = Instance.new("Part",Gun)
  130. Beam.BrickColor = BrickColor.new("New Yeller")
  131. Beam.Material = Enum.Material.Neon
  132. Beam.Locked = true
  133. Beam.Anchored = true
  134. Beam.CanCollide = false
  135. Beam.CastShadow = false
  136. Beam.Size = Vector3.new(0.1,0.1,Distance)
  137. Beam.CFrame = CFrame.new(Gun.CFrame.p,Pos)*CFrame.new(0,0,-Distance/2)
  138. game.Debris:AddItem(Beam,.2)
  139. TweenService:Create(Beam,TweenInfo.new(.2),{Size = Vector3.new(.5,.5,Distance);Transparency = 1;Color = Color3.fromRGB(213,115,61)}):Play()
  140. local Effect = Instance.new("Part",Gun)
  141. Effect.Name = "Effect"
  142. Effect.Material = Enum.Material.Neon
  143. Effect.Shape = Enum.PartType.Ball
  144. Effect.BrickColor = BrickColor.new("New Yeller")
  145. Effect.Size = Vector3.new(.25,.25,.25)
  146. Effect.CanCollide = false
  147. Effect.Anchored = true
  148. Effect.CastShadow = false
  149. Effect.Position = Pos
  150. game.Debris:AddItem(Effect,.2)
  151. TweenService:Create(Effect,TweenInfo.new(.2),{Size = Vector3.new(3,3,3);Transparency = 1;Color = Color3.fromRGB(213,115,61)}):Play()
  152. if TargetPart then
  153. if TargetPart.Parent and TargetPart.Parent:FindFirstChild("Humanoid") then
  154. TargetPart.Parent.Humanoid:TakeDamage(10)
  155. end
  156. end
  157. end
  158. end
  159. end))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement