UhhLegoboy

Shotgun Free Model Script

Apr 15th, 2017
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 27.86 KB | None | 0 0
  1. local runDummyScript = function(f,scri)
  2. local oldenv = getfenv(f)
  3. local newenv = setmetatable({}, {
  4. __index = function(_, k)
  5. if k:lower() == 'script' then
  6. return scri
  7. else
  8. return oldenv[k]
  9. end
  10. end
  11. })
  12. setfenv(f, newenv)
  13. ypcall(function() f() end)
  14. end
  15. cors = {}
  16. mas = Instance.new("Model",game:GetService("Lighting"))
  17. mas.Name = "CompiledModel"
  18. o1 = Instance.new("Tool")
  19. o2 = Instance.new("Part")
  20. o3 = Instance.new("SpecialMesh")
  21. o4 = Instance.new("Sound")
  22. o5 = Instance.new("Sound")
  23. o6 = Instance.new("Sound")
  24. o7 = Instance.new("Sound")
  25. o8 = Instance.new("PointLight")
  26. o9 = Instance.new("Sound")
  27. o11 = Instance.new("Animation")
  28. o12 = Instance.new("ScreenGui")
  29. o13 = Instance.new("Frame")
  30. o14 = Instance.new("TextLabel")
  31. o15 = Instance.new("TextLabel")
  32. o16 = Instance.new("TextLabel")
  33. o17 = Instance.new("Frame")
  34. o18 = Instance.new("Frame")
  35. o19 = Instance.new("Frame")
  36. o20 = Instance.new("Frame")
  37. o21 = Instance.new("ImageLabel")
  38. o22 = Instance.new("TextLabel")
  39. o23 = Instance.new("Frame")
  40. o24 = Instance.new("Frame")
  41. o25 = Instance.new("TextLabel")
  42. o26 = Instance.new("LocalScript")
  43. o27 = Instance.new("LocalScript")
  44. o28 = Instance.new("LocalScript")
  45. o29 = Instance.new("Part")
  46. o30 = Instance.new("SpecialMesh")
  47. o31 = Instance.new("Part")
  48. o32 = Instance.new("SpecialMesh")
  49. o33 = Instance.new("Part")
  50. o34 = Instance.new("SpecialMesh")
  51. o35 = Instance.new("Part")
  52. o36 = Instance.new("SpecialMesh")
  53. o37 = Instance.new("Part")
  54. o38 = Instance.new("CylinderMesh")
  55. o39 = Instance.new("Script")
  56. o1.Name = "M870"
  57. o1.Parent = mas
  58. o1.TextureId = "http://www.roblox.com/asset/?id=122079958"
  59. o1.GripForward = Vector3.new(-0.242524415, 0.970096886, -0.00969904661)
  60. o1.GripPos = Vector3.new(0.25999999, -0.600000024, -0.330000013)
  61. o1.GripRight = Vector3.new(0.970145285, 0.242512301, -0.00242490321)
  62. o1.GripUp = Vector3.new(2.23517418e-007, 0.00999760628, 0.999950111)
  63. o1.ToolTip = "Ithaca 37"
  64. o1.CanBeDropped = false
  65. o2.Name = "Handle"
  66. o2.Parent = o1
  67. o2.BrickColor = BrickColor.new("Black")
  68. o2.Position = Vector3.new(-72.2855453, 0.500015974, -32.7285843)
  69. o2.Rotation = Vector3.new(-90, 0, -90)
  70. o2.FormFactor = Enum.FormFactor.Custom
  71. o2.Size = Vector3.new(0.200000003, 2.79999995, 1)
  72. o2.CFrame = CFrame.new(-72.2855453, 0.500015974, -32.7285843, 0, 1, 0, 0, 0, 1, 1, 0, 0)
  73. o2.BottomSurface = Enum.SurfaceType.Smooth
  74. o2.TopSurface = Enum.SurfaceType.Smooth
  75. o2.Color = Color3.new(0.105882, 0.164706, 0.207843)
  76. o2.Position = Vector3.new(-72.2855453, 0.500015974, -32.7285843)
  77. o3.Parent = o2
  78. o3.MeshId = "http://www.roblox.com/asset/?id=71947462"
  79. o3.Scale = Vector3.new(1.20000005, 1, 1.20000005)
  80. o3.TextureId = "http://www.roblox.com/asset/?id=71947415"
  81. o3.MeshType = Enum.MeshType.FileMesh
  82. o4.Name = "FireSound"
  83. o4.Parent = o2
  84. o4.Pitch = 0.94999998807907
  85. o4.SoundId = "http://roblox.com/asset/?id=130780450 "
  86. o4.Volume = 1
  87. o5.Name = "PumpSound"
  88. o5.Parent = o2
  89. o5.Pitch = 0.80000001192093
  90. o5.SoundId = "http://www.roblox.com/asset/?id=10209881"
  91. o5.Volume = 1
  92. o6.Name = "Reload"
  93. o6.Parent = o2
  94. o6.SoundId = "http://roblox.com/asset/?id=10209845 "
  95. o6.Volume = 1
  96. o7.Name = "EquipSound"
  97. o7.Parent = o2
  98. o7.SoundId = "http://www.roblox.com/asset/?id=10209881"
  99. o7.Volume = 1
  100. o8.Name = "Flash"
  101. o8.Parent = o2
  102. o8.Color = Color3.new(1, 1, 0)
  103. o8.Enabled = false
  104. o8.Brightness = 1.5
  105. o9.Name = "Tick"
  106. o9.Parent = o2
  107. o9.SoundId = "rbxasset://sounds//clickfast.wav"
  108. o9.Volume = 1
  109. o11.Name = "Recoil"
  110. o11.Parent = o1
  111. o11.AnimationId = "http://www.roblox.com/Asset?ID=94331086"
  112. o12.Name = "WeaponHud"
  113. o12.Parent = o1
  114. o13.Name = "AmmoHud"
  115. o13.Parent = o12
  116. o13.Position = UDim2.new(1,-265,1,-60)
  117. o13.Size = UDim2.new(0,200,0,50)
  118. o13.Style = Enum.FrameStyle.RobloxSquare
  119. o13.Position = UDim2.new(1,-265,1,-60)
  120. o13.BackgroundTransparency = 1
  121. o13.BorderSizePixel = 0
  122. o14.Name = "ForwardSlash"
  123. o14.Parent = o13
  124. o14.Position = UDim2.new(0.5,0,0.5,0)
  125. o14.Text = "/"
  126. o14.Position = UDim2.new(0.5,0,0.5,0)
  127. o14.BackgroundTransparency = 1
  128. o14.BorderSizePixel = 0
  129. o14.FontSize = Enum.FontSize.Size24
  130. o14.TextColor3 = Color3.new(1, 1, 1)
  131. o14.TextStrokeTransparency = 0
  132. o15.Name = "ClipAmmo"
  133. o15.Parent = o13
  134. o15.Position = UDim2.new(0.44999998807907,0,0.5,0)
  135. o15.Text = "54"
  136. o15.Position = UDim2.new(0.44999998807907,0,0.5,0)
  137. o15.BackgroundTransparency = 1
  138. o15.BorderSizePixel = 0
  139. o15.FontSize = Enum.FontSize.Size24
  140. o15.TextColor3 = Color3.new(1, 1, 1)
  141. o15.TextStrokeTransparency = 0
  142. o15.TextXAlignment = Enum.TextXAlignment.Right
  143. o16.Name = "TotalAmmo"
  144. o16.Parent = o13
  145. o16.Position = UDim2.new(0.55000001192093,0,0.5,0)
  146. o16.Text = "180"
  147. o16.Position = UDim2.new(0.55000001192093,0,0.5,0)
  148. o16.BackgroundTransparency = 1
  149. o16.BorderSizePixel = 0
  150. o16.FontSize = Enum.FontSize.Size24
  151. o16.TextColor3 = Color3.new(1, 1, 1)
  152. o16.TextStrokeTransparency = 0
  153. o16.TextXAlignment = Enum.TextXAlignment.Left
  154. o17.Name = "Crosshair"
  155. o17.Parent = o12
  156. o17.Position = UDim2.new(0,500,0,500)
  157. o17.Size = UDim2.new(0,150,0,150)
  158. o17.Position = UDim2.new(0,500,0,500)
  159. o17.BackgroundColor3 = Color3.new(0, 1, 0)
  160. o17.BackgroundTransparency = 1
  161. o17.BorderSizePixel = 0
  162. o18.Name = "TopFrame"
  163. o18.Parent = o17
  164. o18.Position = UDim2.new(0,-1,-0.5,-7)
  165. o18.Size = UDim2.new(0,2,0,14)
  166. o18.Position = UDim2.new(0,-1,-0.5,-7)
  167. o18.BackgroundColor3 = Color3.new(1, 1, 1)
  168. o18.BorderColor3 = Color3.new(0, 0, 0)
  169. o19.Name = "RightFrame"
  170. o19.Parent = o17
  171. o19.Position = UDim2.new(0.5,-7,0,-1)
  172. o19.Size = UDim2.new(0,14,0,2)
  173. o19.Position = UDim2.new(0.5,-7,0,-1)
  174. o19.BackgroundColor3 = Color3.new(1, 1, 1)
  175. o19.BorderColor3 = Color3.new(0, 0, 0)
  176. o20.Name = "LeftFrame"
  177. o20.Parent = o17
  178. o20.Position = UDim2.new(-0.5,-7,0,-1)
  179. o20.Size = UDim2.new(0,14,0,2)
  180. o20.Position = UDim2.new(-0.5,-7,0,-1)
  181. o20.BackgroundColor3 = Color3.new(1, 1, 1)
  182. o20.BorderColor3 = Color3.new(0, 0, 0)
  183. o21.Name = "TargetHitImage"
  184. o21.Parent = o17
  185. o21.Position = UDim2.new(0,-25,0,-25)
  186. o21.Size = UDim2.new(0,50,0,50)
  187. o21.Position = UDim2.new(0,-25,0,-25)
  188. o21.Visible = false
  189. o21.BackgroundTransparency = 1
  190. o21.BorderSizePixel = 0
  191. o21.Image = "http://www.roblox.com/asset/?id=115400215"
  192. o22.Name = "ReloadingLabel"
  193. o22.Parent = o17
  194. o22.Position = UDim2.new(0,20,0,-20)
  195. o22.Text = "Reloading"
  196. o22.Position = UDim2.new(0,20,0,-20)
  197. o22.Visible = false
  198. o22.BackgroundTransparency = 1
  199. o22.BorderSizePixel = 0
  200. o22.Font = Enum.Font.ArialBold
  201. o22.FontSize = Enum.FontSize.Size18
  202. o22.TextColor3 = Color3.new(1, 1, 1)
  203. o22.TextStrokeTransparency = 0
  204. o22.TextXAlignment = Enum.TextXAlignment.Left
  205. o22.TextYAlignment = Enum.TextYAlignment.Bottom
  206. o23.Name = "BottomFrame"
  207. o23.Parent = o17
  208. o23.Position = UDim2.new(0,-1,0.5,-7)
  209. o23.Size = UDim2.new(0,2,0,14)
  210. o23.Position = UDim2.new(0,-1,0.5,-7)
  211. o23.BackgroundColor3 = Color3.new(1, 1, 1)
  212. o23.BorderColor3 = Color3.new(0, 0, 0)
  213. o24.Name = "Reload"
  214. o24.Parent = o12
  215. o24.Position = UDim2.new(1,-265,1,-120)
  216. o24.Size = UDim2.new(0,200,0,50)
  217. o24.Position = UDim2.new(1,-265,1,-120)
  218. o24.Visible = false
  219. o24.BackgroundTransparency = 1
  220. o24.BorderSizePixel = 0
  221. o25.Name = "Reload"
  222. o25.Parent = o24
  223. o25.Position = UDim2.new(0.5,0,0.5,0)
  224. o25.Text = "Press R to Reload"
  225. o25.Position = UDim2.new(0.5,0,0.5,0)
  226. o25.BackgroundTransparency = 1
  227. o25.BorderSizePixel = 0
  228. o25.Font = Enum.Font.ArialBold
  229. o25.FontSize = Enum.FontSize.Size24
  230. o25.TextColor3 = Color3.new(1, 0, 0)
  231. o25.TextStrokeTransparency = 0
  232. o26.Name = "Ithaca"
  233. o26.Parent = o1
  234. table.insert(cors,coroutine.create(function()
  235. wait()
  236. runDummyScript(function()
  237. --------------------- TEMPLATE ASSAULT RIFLE WEAPON ---------------------------
  238. -- Waits for the child of the specified parent
  239. local function WaitForChild(parent, childName)
  240.     while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
  241.     return parent[childName]
  242. end
  243.  
  244. ----- MAGIC NUMBERS ABOUT THE TOOL -----
  245. -- How much damage a bullet does
  246. local Damage = 70
  247. -- How many times per second the gun can fire
  248. local FireRate = 1 / 1.33
  249. -- The maximum distance the can can shoot, this value should never go above 1000
  250. local Range = 200
  251. -- In radians the minimum accuracy penalty
  252. local MinSpread = 0.05
  253. -- In radian the maximum accuracy penalty
  254. local MaxSpread = 0.1
  255. -- Number of bullets in a clip
  256. local ClipSize = 6
  257. -- DefaultValue for spare ammo
  258. local SpareAmmo = 300
  259. -- The amount the aim will increase or decrease by
  260. -- decreases this number reduces the speed that recoil takes effect
  261. local AimInaccuracyStepAmount = 0.0133
  262. -- Time it takes to reload weapon
  263. local ReloadTime = 4
  264. ----------------------------------------
  265.  
  266. -- Colors
  267. local FriendlyReticleColor = Color3.new(0, 1, 0)
  268. local EnemyReticleColor = Color3.new(1, 0, 0)
  269. local NeutralReticleColor   = Color3.new(1, 1, 1)
  270.  
  271. local Spread = MinSpread
  272. local AmmoInClip = ClipSize
  273.  
  274. local Tool = script.Parent
  275. local Handle = WaitForChild(Tool, 'Handle')
  276. local WeaponGui = nil
  277.  
  278. local LeftButtonDown
  279. local Reloading = false
  280. local IsShooting = false
  281.  
  282. -- Player specific convenience variables
  283. local MyPlayer = nil
  284. local MyCharacter = nil
  285. local MyHumanoid = nil
  286. local MyTorso = nil
  287. local MyMouse = nil
  288.  
  289. local RecoilAnim
  290. local RecoilTrack = nil
  291.  
  292. local IconURL = Tool.TextureId  -- URL to the weapon icon asset
  293.  
  294. local DebrisService = game:GetService('Debris')
  295. local PlayersService = game:GetService('Players')
  296.  
  297.  
  298. local FireSound
  299.  
  300. local OnFireConnection = nil
  301. local OnReloadConnection = nil
  302.  
  303. local DecreasedAimLastShot = false
  304. local LastSpreadUpdate = time()
  305.  
  306. -- this is a dummy object that holds the flash made when the gun is fired
  307. local FlashHolder = nil
  308.  
  309.  
  310. local WorldToCellFunction = Workspace.Terrain.WorldToCellPreferSolid
  311. local GetCellFunction = Workspace.Terrain.GetCell
  312.  
  313. function RayIgnoreCheck(hit, pos)
  314.     if hit then
  315.         if hit.Transparency >= 1 or string.lower(hit.Name) == "water" or
  316.                 hit.Name == "Effect" or hit.Name == "Rocket" or hit.Name == "Bullet" or
  317.                 hit.Name == "Handle" or hit:IsDescendantOf(MyCharacter) then
  318.             return true
  319.         elseif hit:IsA('Terrain') and pos then
  320.             local cellPos = WorldToCellFunction(Workspace.Terrain, pos)
  321.             if cellPos then
  322.                 local cellMat = GetCellFunction(Workspace.Terrain, cellPos.x, cellPos.y, cellPos.z)
  323.                 if cellMat and cellMat == Enum.CellMaterial.Water then
  324.                     return true
  325.                 end
  326.             end
  327.         end
  328.     end
  329.     return false
  330. end
  331.  
  332. -- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000
  333. function RayCast(startPos, vec, rayLength)
  334.     local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle)
  335.     if hitObject and hitPos then
  336.         local distance = rayLength - (hitPos - startPos).magnitude
  337.         if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then
  338.             -- there is a chance here for potential infinite recursion
  339.             return RayCast(hitPos, vec, distance)
  340.         end
  341.     end
  342.     return hitObject, hitPos
  343. end
  344.  
  345.  
  346.  
  347. function TagHumanoid(humanoid, player)
  348.     -- Add more tags here to customize what tags are available.
  349.     while humanoid:FindFirstChild('creator') do
  350.         humanoid:FindFirstChild('creator'):Destroy()
  351.     end
  352.     local creatorTag = Instance.new("ObjectValue")
  353.     creatorTag.Value = player
  354.     creatorTag.Name = "creator"
  355.     creatorTag.Parent = humanoid
  356.     DebrisService:AddItem(creatorTag, 1.5)
  357.  
  358.     local weaponIconTag = Instance.new("StringValue")
  359.     weaponIconTag.Value = IconURL
  360.     weaponIconTag.Name = "icon"
  361.     weaponIconTag.Parent = creatorTag
  362. end
  363.  
  364.  
  365. local function CreateBullet(bulletPos)
  366.     local bullet = Instance.new('Part', Workspace)
  367.     bullet.FormFactor = Enum.FormFactor.Custom
  368.     bullet.Size = Vector3.new(0.1, 0.1, 0.1)
  369.     bullet.BrickColor = BrickColor.new("Black")
  370.     bullet.Shape = Enum.PartType.Block
  371.     bullet.CanCollide = false
  372.     bullet.CFrame = CFrame.new(bulletPos)
  373.     bullet.Anchored = true
  374.     bullet.TopSurface = Enum.SurfaceType.Smooth
  375.     bullet.BottomSurface = Enum.SurfaceType.Smooth
  376.     bullet.Name = 'Bullet'
  377.     DebrisService:AddItem(bullet, 2.5)
  378.     return bullet
  379. end
  380.  
  381. local function Reload()
  382.     if not Reloading then
  383.         Reloading = true
  384.         -- Don't reload if you are already full or have no extra ammo
  385.         if AmmoInClip ~= ClipSize and SpareAmmo > 0 then
  386.             if RecoilTrack then
  387.                 RecoilTrack:Stop()
  388.             end
  389.             if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
  390.                 if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
  391.                     WeaponGui.Crosshair.ReloadingLabel.Visible = true
  392.                 end
  393.             end
  394.             script.Parent.Handle.Reload:Play()
  395.             wait(.75)
  396.             script.Parent.Handle.Reload:Play()
  397.             wait(.75)
  398.             script.Parent.Handle.Reload:Play()
  399.             wait(.75)
  400.             script.Parent.Handle.Reload:Play()
  401.             wait(.75)
  402.             script.Parent.Handle.PumpSound:Play()
  403.             -- Only use as much ammo as you have
  404.             local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo)
  405.             AmmoInClip = AmmoInClip + ammoToUse
  406.             SpareAmmo = SpareAmmo - ammoToUse
  407.             UpdateAmmo(AmmoInClip)
  408.             WeaponGui.Reload.Visible = false
  409.         end
  410.         Reloading = false
  411.     end
  412. end
  413.  
  414. function OnFire()
  415.     if IsShooting then return end
  416.     if MyHumanoid and MyHumanoid.Health > 0 then
  417.         if RecoilTrack and AmmoInClip > 0 then
  418.             RecoilTrack:Play()
  419.         end
  420.         IsShooting = true
  421.         while LeftButtonDown and AmmoInClip > 0 and not Reloading do
  422.             if Spread and not DecreasedAimLastShot then
  423.                 Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount)
  424.                 UpdateCrosshair(Spread)
  425.             end
  426.             DecreasedAimLastShot = not DecreasedAimLastShot
  427.             if Handle:FindFirstChild('FireSound') then
  428.                 Handle.FireSound:Play()
  429.                 Handle.Flash.Enabled = true
  430.             end
  431.             if MyMouse then
  432.                 for i = 1,12 do -- Shotgun effect :P
  433.                     local targetPoint = MyMouse.Hit.p
  434.                     local shootDirection = (targetPoint - Handle.Position).unit
  435.                     -- Adjust the shoot direction randomly off by a little bit to account for recoil
  436.                     shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
  437.                                                                     (0.5 - math.random()) * 2 * Spread,
  438.                                                                     (0.5 - math.random()) * 2 * Spread) * shootDirection
  439.                     local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
  440.                     local bullet
  441.                     -- Create a bullet here
  442.                     if hitObject then
  443.                         bullet = CreateBullet(bulletPos)
  444.                     end
  445.                     if hitObject and hitObject.Parent then
  446.                         local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
  447.                         if hitHumanoid then
  448.                             local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
  449.                             if MyPlayer.Neutral or hitPlayer then
  450.                                 TagHumanoid(hitHumanoid, MyPlayer)
  451.                                 hitHumanoid:TakeDamage(Damage)
  452.                                 if bullet then
  453.                                     bullet:Destroy()
  454.                                     bullet = nil
  455.                                     --bullet.Transparency = 1
  456.                                 end
  457.                                 Spawn(UpdateTargetHit)
  458.                             elseif not hitPlayer then
  459.                                 TagHumanoid(hitHumanoid, MyPlayer)
  460.                                 hitHumanoid:TakeDamage(Damage)
  461.                                 if bullet then
  462.                                     bullet:Destroy()
  463.                                     bullet = nil
  464.                                     --bullet.Transparency = 1
  465.                                 end
  466.                                 Spawn(UpdateTargetHit)
  467.                             end
  468.                         end
  469.                     end
  470.                 end
  471.                 AmmoInClip = AmmoInClip - 1
  472.                 UpdateAmmo(AmmoInClip)
  473.             end
  474.             Handle.PumpSound:Play()
  475.             wait(.2); Handle.Flash.Enabled = false
  476.             wait(FireRate)
  477.             OnMouseUp()
  478.         end
  479.         IsShooting = false
  480.         if AmmoInClip == 0 then
  481.             Handle.Tick:Play()
  482.             WeaponGui.Reload.Visible = true
  483.         end
  484.         if RecoilTrack then
  485.             RecoilTrack:Stop()
  486.         end
  487.     end
  488. end
  489.  
  490. local TargetHits = 0
  491. function UpdateTargetHit()
  492.     TargetHits = TargetHits + 1
  493.     if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
  494.         WeaponGui.Crosshair.TargetHitImage.Visible = true
  495.     end
  496.     wait(0.5)
  497.     TargetHits = TargetHits - 1
  498.     if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
  499.         WeaponGui.Crosshair.TargetHitImage.Visible = false
  500.     end
  501. end
  502.  
  503. function UpdateCrosshair(value, mouse)
  504.     if WeaponGui then
  505.         local absoluteY = 650
  506.         WeaponGui.Crosshair:TweenSize(
  507.             UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23),
  508.             Enum.EasingDirection.Out,
  509.             Enum.EasingStyle.Linear,
  510.             0.33)
  511.     end
  512. end
  513.  
  514. function UpdateAmmo(value)
  515.     if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
  516.         WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip
  517.         if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
  518.             WeaponGui.Crosshair.ReloadingLabel.Visible = false
  519.         end
  520.     end
  521.     if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
  522.         WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo
  523.     end
  524. end
  525.  
  526.  
  527. function OnMouseDown()
  528.     LeftButtonDown = true
  529.     OnFire()
  530. end
  531.  
  532. function OnMouseUp()
  533.     LeftButtonDown = false
  534. end
  535.  
  536. function OnKeyDown(key)
  537.     if string.lower(key) == 'r' then
  538.         Reload()
  539.     end
  540. end
  541.  
  542.  
  543. function OnEquipped(mouse)
  544.     Handle.EquipSound:Play()
  545.     RecoilAnim = WaitForChild(Tool, 'Recoil')
  546.     FireSound  = WaitForChild(Handle, 'FireSound')
  547.  
  548.     MyCharacter = Tool.Parent
  549.     MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
  550.     MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
  551.     MyTorso = MyCharacter:FindFirstChild('Torso')
  552.     MyMouse = mouse
  553.     WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone()
  554.     if WeaponGui and MyPlayer then
  555.         WeaponGui.Parent = MyPlayer.PlayerGui
  556.         UpdateAmmo(AmmoInClip)
  557.     end
  558.     if RecoilAnim then
  559.         RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim)
  560.     end
  561.  
  562.     if MyMouse then
  563.         -- Disable mouse icon
  564.         MyMouse.Icon = "http://www.roblox.com/asset/?id=18662154"
  565.         MyMouse.Button1Down:connect(OnMouseDown)
  566.         MyMouse.Button1Up:connect(OnMouseUp)
  567.         MyMouse.KeyDown:connect(OnKeyDown)
  568.     end
  569. end
  570.  
  571.  
  572. -- Unequip logic here
  573. function OnUnequipped()
  574.     LeftButtonDown = false
  575.     Reloading = false
  576.     MyCharacter = nil
  577.     MyHumanoid = nil
  578.     MyTorso = nil
  579.     MyPlayer = nil
  580.     MyMouse = nil
  581.     if OnFireConnection then
  582.         OnFireConnection:disconnect()
  583.     end
  584.     if OnReloadConnection then
  585.         OnReloadConnection:disconnect()
  586.     end
  587.     if FlashHolder then
  588.         FlashHolder = nil
  589.     end
  590.     if WeaponGui then
  591.         WeaponGui.Parent = nil
  592.         WeaponGui = nil
  593.     end
  594.     if RecoilTrack then
  595.         RecoilTrack:Stop()
  596.     end
  597. end
  598.  
  599. local function SetReticleColor(color)
  600.     if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
  601.         for _, line in pairs(WeaponGui.Crosshair:GetChildren()) do
  602.             if line:IsA('Frame') then
  603.                 line.BorderColor3 = color
  604.             end
  605.         end
  606.     end
  607. end
  608.  
  609.  
  610. Tool.Equipped:connect(OnEquipped)
  611. Tool.Unequipped:connect(OnUnequipped)
  612.  
  613. while true do
  614.     wait(0.033)
  615.     if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and MyMouse then
  616.         WeaponGui.Crosshair.Position = UDim2.new(0, MyMouse.X, 0, MyMouse.Y)
  617.         SetReticleColor(NeutralReticleColor)
  618.  
  619.         local target = MyMouse.Target
  620.         if target and target.Parent then
  621.             local player = PlayersService:GetPlayerFromCharacter(target.Parent)
  622.             if player then
  623.                 if MyPlayer.Neutral or player.TeamColor ~= MyPlayer.TeamColor then
  624.                     SetReticleColor(EnemyReticleColor)
  625.                 else
  626.                     SetReticleColor(FriendlyReticleColor)
  627.                 end
  628.             end
  629.         end
  630.     end
  631.     if Spread and not IsShooting then
  632.         local currTime = time()
  633.         if currTime - LastSpreadUpdate > FireRate * 2 then
  634.             LastSpreadUpdate = currTime
  635.             Spread = math.max(MinSpread, Spread - AimInaccuracyStepAmount)
  636.             UpdateCrosshair(Spread, MyMouse)
  637.         end
  638.     end
  639. end
  640. end,o26)
  641. end))
  642. o27.Name = "ArmWeld [Shotgun]"
  643. o27.Parent = o1
  644. table.insert(cors,coroutine.create(function()
  645. wait()
  646. runDummyScript(function()
  647. Tool = script.Parent;
  648.  
  649. local arms = nil
  650. local torso = nil
  651. local welds = {}
  652.  
  653. function Equip(mouse)
  654. wait(0.01)
  655. arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
  656. torso = Tool.Parent:FindFirstChild("Torso")
  657. if arms ~= nil and torso ~= nil then
  658. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  659. if sh ~= nil then
  660. local yes = true
  661. if yes then
  662. yes = false
  663. sh[1].Part1 = nil
  664. sh[2].Part1 = nil
  665. local weld1 = Instance.new("Weld")
  666. weld1.Part0 = torso
  667. weld1.Parent = torso
  668. weld1.Part1 = arms[1]
  669. weld1.C1 = CFrame.new(-.1, 1.25, .6) * CFrame.fromEulerAnglesXYZ(math.rad(290), math.rad(10), math.rad(-90)) ---The first set of numbers changes where the arms move to the second set changes their angles
  670. welds[1] = weld1
  671. weld1.Name = "weld1"
  672. local weld2 = Instance.new("Weld")
  673. weld2.Part0 = torso
  674. weld2.Parent = torso
  675. weld2.Part1 = arms[2]
  676. weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0) --- Same as top
  677. welds[2] = weld2
  678. weld2.Name = "weld2"
  679. end
  680. else
  681. print("sh")
  682. end
  683. else
  684. print("arms")
  685. end
  686. end
  687.  
  688. function Unequip(mouse)
  689. if arms ~= nil and torso ~= nil then
  690. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  691. if sh ~= nil then
  692. local yes = true
  693. if yes then
  694. yes = false
  695. sh[1].Part1 = arms[1]
  696. sh[2].Part1 = arms[2]
  697. welds[1].Parent = nil
  698. welds[2].Parent = nil
  699. end
  700. else
  701. print("sh")
  702. end
  703. else
  704. print("arms")
  705. end
  706. end
  707. Tool.Equipped:connect(Equip)
  708. Tool.Unequipped:connect(Unequip)
  709.  
  710. end,o27)
  711. end))
  712. o28.Name = "Patrol [Shotgun]"
  713. o28.Parent = o1
  714. table.insert(cors,coroutine.create(function()
  715. wait()
  716. runDummyScript(function()
  717. --Note this must be used with the accompanying weld script
  718. --This is an edited version of my V3 KeyCommand Script.
  719. --Heavily edited from a free model crouch script, ~ukwarrior6~
  720.  
  721. ----------------------------
  722. --Patrol Script--
  723. ----------------------------
  724.  
  725. on = 0
  726. Tool = script.Parent
  727. welds = {}
  728. sh = {}
  729. arms = nil
  730. torso = nil
  731. f = nil
  732. Holstered = false
  733. wait()
  734. local Tool = script.Parent
  735. enabled = true
  736. ----------------------------------------------------------------------------------------------------------------
  737. function GunUp()
  738. Holstered = false
  739. Tool.Enabled = true
  740. torso = Tool.Parent:FindFirstChild("Torso")
  741. if torso ~= nil then
  742. torso.weld1.C1 = CFrame.new(-.1, 1.25, .6) * CFrame.fromEulerAnglesXYZ(math.rad(290), math.rad(10), math.rad(-90))
  743. torso.weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  744. end
  745. end
  746.  
  747. function GunDown()
  748. Holstered = true
  749. Tool.Enabled = false -- You don't want to be shooting if your not aiming
  750. torso = Tool.Parent:FindFirstChild("Torso")
  751. if torso ~= nil then
  752. torso.weld1.C1 = CFrame.new(-.1, 1.25, .6) * CFrame.fromEulerAnglesXYZ(math.rad(280), math.rad(-10), math.rad(-80))
  753. torso.weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-70), math.rad(-25), math.rad(0))
  754. end
  755. end
  756. -----------------------------------------------------------------------------------------------------------------
  757. function onEquippedLocal(mouse)
  758.    mouse.Icon = "" -- Chuck in a cool crosshair here..
  759.     mouse.KeyDown:connect(onKeyDown)
  760. end
  761. -----------------------------------------------------------------------------------------------------------------
  762. function onKeyDown(key)
  763. if (key~=nil) then
  764. key = key:lower()
  765.  
  766. if (key=="e")  then -- Toggle Patrol
  767. if Holstered == true then
  768. script.Parent.Parent.Humanoid.WalkSpeed = 16
  769. GunUp()
  770. elseif Holstered == false then
  771. script.Parent.Parent.Humanoid.WalkSpeed = 20
  772. GunDown()
  773. end end end end
  774. Tool.Equipped:connect(onEquippedLocal)
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781. end,o28)
  782. end))
  783. o29.Name = "12 Gauge Slugs"
  784. o29.Parent = o1
  785. o29.BrickColor = BrickColor.new("Medium green")
  786. o29.Position = Vector3.new(-73.0601883, 0.659587979, -32.8816261)
  787. o29.Rotation = Vector3.new(-90, 2.45901902e-006, 90)
  788. o29.Anchored = true
  789. o29.FormFactor = Enum.FormFactor.Custom
  790. o29.Size = Vector3.new(0.200000003, 0.200000003, 0.550000191)
  791. o29.CFrame = CFrame.new(-73.0601883, 0.659587979, -32.8816261, 1.0658141e-014, -1, 4.29179785e-008, 1.44884105e-014, 4.29179714e-008, 1, -1, -4.52982114e-008, -4.37113741e-008)
  792. o29.BottomSurface = Enum.SurfaceType.Smooth
  793. o29.TopSurface = Enum.SurfaceType.Smooth
  794. o29.Color = Color3.new(0.631373, 0.768628, 0.54902)
  795. o29.Position = Vector3.new(-73.0601883, 0.659587979, -32.8816261)
  796. o30.Parent = o29
  797. o30.MeshId = "http://www.roblox.com/asset/?id=94248124"
  798. o30.TextureId = "http://www.roblox.com/asset/?id=116456647"
  799. o30.MeshType = Enum.MeshType.FileMesh
  800. o31.Name = "12 Gauge Slugs"
  801. o31.Parent = o1
  802. o31.BrickColor = BrickColor.new("Medium green")
  803. o31.Position = Vector3.new(-72.7001801, 0.659587979, -32.8816261)
  804. o31.Rotation = Vector3.new(-90, 2.45901902e-006, 90)
  805. o31.Anchored = true
  806. o31.FormFactor = Enum.FormFactor.Custom
  807. o31.Size = Vector3.new(0.200000003, 0.200000003, 0.550000191)
  808. o31.CFrame = CFrame.new(-72.7001801, 0.659587979, -32.8816261, 1.0658141e-014, -1, 4.29179785e-008, 1.44884105e-014, 4.29179714e-008, 1, -1, -4.52982114e-008, -4.37113741e-008)
  809. o31.BottomSurface = Enum.SurfaceType.Smooth
  810. o31.TopSurface = Enum.SurfaceType.Smooth
  811. o31.Color = Color3.new(0.631373, 0.768628, 0.54902)
  812. o31.Position = Vector3.new(-72.7001801, 0.659587979, -32.8816261)
  813. o32.Parent = o31
  814. o32.MeshId = "http://www.roblox.com/asset/?id=94248124"
  815. o32.TextureId = "http://www.roblox.com/asset/?id=116456647"
  816. o32.MeshType = Enum.MeshType.FileMesh
  817. o33.Name = "12 Gauge Slugs"
  818. o33.Parent = o1
  819. o33.BrickColor = BrickColor.new("Medium green")
  820. o33.Position = Vector3.new(-72.8801727, 0.659587979, -32.8816261)
  821. o33.Rotation = Vector3.new(-90, 2.45901902e-006, 90)
  822. o33.Anchored = true
  823. o33.FormFactor = Enum.FormFactor.Custom
  824. o33.Size = Vector3.new(0.200000003, 0.200000003, 0.550000191)
  825. o33.CFrame = CFrame.new(-72.8801727, 0.659587979, -32.8816261, 1.0658141e-014, -1, 4.29179785e-008, 1.44884105e-014, 4.29179714e-008, 1, -1, -4.52982114e-008, -4.37113741e-008)
  826. o33.BottomSurface = Enum.SurfaceType.Smooth
  827. o33.TopSurface = Enum.SurfaceType.Smooth
  828. o33.Color = Color3.new(0.631373, 0.768628, 0.54902)
  829. o33.Position = Vector3.new(-72.8801727, 0.659587979, -32.8816261)
  830. o34.Parent = o33
  831. o34.MeshId = "http://www.roblox.com/asset/?id=94248124"
  832. o34.TextureId = "http://www.roblox.com/asset/?id=116456647"
  833. o34.MeshType = Enum.MeshType.FileMesh
  834. o35.Name = "12 Gauge Slugs"
  835. o35.Parent = o1
  836. o35.BrickColor = BrickColor.new("Medium green")
  837. o35.Position = Vector3.new(-73.2401886, 0.659588993, -32.8816261)
  838. o35.Rotation = Vector3.new(-90, 2.45901902e-006, 90)
  839. o35.Anchored = true
  840. o35.FormFactor = Enum.FormFactor.Custom
  841. o35.Size = Vector3.new(0.200000003, 0.200000003, 0.550000191)
  842. o35.CFrame = CFrame.new(-73.2401886, 0.659588993, -32.8816261, 1.0658141e-014, -1, 4.29179785e-008, 1.44884105e-014, 4.29179714e-008, 1, -1, -4.52982114e-008, -4.37113741e-008)
  843. o35.BottomSurface = Enum.SurfaceType.Smooth
  844. o35.TopSurface = Enum.SurfaceType.Smooth
  845. o35.Color = Color3.new(0.631373, 0.768628, 0.54902)
  846. o35.Position = Vector3.new(-73.2401886, 0.659588993, -32.8816261)
  847. o36.Parent = o35
  848. o36.MeshId = "http://www.roblox.com/asset/?id=94248124"
  849. o36.TextureId = "http://www.roblox.com/asset/?id=116456647"
  850. o36.MeshType = Enum.MeshType.FileMesh
  851. o37.Parent = o1
  852. o37.BrickColor = BrickColor.new("Really black")
  853. o37.Position = Vector3.new(-72.967926, 0.740015984, -32.7389069)
  854. o37.Rotation = Vector3.new(0, 0, 90)
  855. o37.Anchored = true
  856. o37.FormFactor = Enum.FormFactor.Symmetric
  857. o37.Size = Vector3.new(1, 1, 1)
  858. o37.CFrame = CFrame.new(-72.967926, 0.740015984, -32.7389069, 0, -1, 0, 1, 0, -0, 0, 0, 1)
  859. o37.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  860. o37.Position = Vector3.new(-72.967926, 0.740015984, -32.7389069)
  861. o38.Parent = o37
  862. o38.Scale = Vector3.new(0.400000006, 0.699999988, 0.5)
  863. o39.Name = "Welding"
  864. o39.Parent = o1
  865. table.insert(cors,coroutine.create(function()
  866. wait()
  867. runDummyScript(function()
  868. function Weld(x,y)
  869.     local W = Instance.new("Weld")
  870.     W.Part0 = x
  871.     W.Part1 = y
  872.     local CJ = CFrame.new(x.Position)
  873.     local C0 = x.CFrame:inverse()*CJ
  874.     local C1 = y.CFrame:inverse()*CJ
  875.     W.C0 = C0
  876.     W.C1 = C1
  877.     W.Parent = x
  878. end
  879.  
  880. function Get(A)
  881.     if A.className == "Part" then
  882.         Weld(script.Parent.Handle, A)
  883.         A.Anchored = false
  884.     else
  885.         local C = A:GetChildren()
  886.         for i=1, #C do
  887.         Get(C[i])
  888.         end
  889.     end
  890. end
  891.  
  892. function Finale()
  893.     Get(script.Parent)
  894. end
  895.  
  896. script.Parent.Equipped:connect(Finale)
  897. script.Parent.Unequipped:connect(Finale)
  898. Finale()
  899. end,o39)
  900. end))
  901. mas.Parent = workspace
  902. mas:MakeJoints()
  903. local mas1 = mas:GetChildren()
  904. for i=1,#mas1 do
  905.     mas1[i].Parent = game:GetService("Players").LocalPlayer.Backpack
  906.     ypcall(function() mas1[i]:MakeJoints() end)
  907. end
  908. mas:Destroy()
  909. for i=1,#cors do
  910. coroutine.resume(cors[i])
  911. end
Add Comment
Please, Sign In to add comment