Advertisement
Guest User

school shooter

a guest
Mar 17th, 2018
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 51.24 KB | None | 0 0
  1. --made by goodguyaiden xd--
  2. --why did i make this--
  3. local Player = game:service'Players'.localPlayer
  4. local chara = Player.Character
  5.  
  6. shirt= Instance.new("Shirt", Character)
  7. shirt.Name = "Shirt"
  8. pants = Instance.new("Pants", Character)
  9. pants.Name = "Pants"
  10. chara.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=679814237"
  11. chara.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=710750764"
  12. local hat = Instance.new("Hat")
  13. hat.Parent = game.Players.LocalPlayer.Character
  14. hat.AttachmentForward = Vector3.new(0,0,-1)
  15. hat.AttachmentPos = Vector3.new(0,0.4,0)
  16. hat.AttachmentRight = Vector3.new(1,0,0)
  17. hat.AttachmentUp = Vector3.new(0,1,0)
  18. hat.Name = "Helmet"
  19. local hatHandle = Instance.new("Part")
  20. hatHandle.Parent = hat
  21. hatHandle.Name = "Handle"
  22. hatHandle.Size = Vector3.new(1.4,1.6,2)
  23. hatHandle.CanCollide = true
  24. local hatMesh = Instance.new("SpecialMesh")
  25. hatMesh.Parent = hatHandle
  26. hatMesh.MeshId = "http://www.roblox.com/asset/?id=16101994"
  27. hatMesh.TextureId = "http://www.roblox.com/asset/?id=16101972"
  28. hatMesh.Scale = Vector3.new(1.2,1.2,1.2)
  29. hatMesh.Offset = Vector3.new(0,0,0)
  30. hatMesh.VertexColor = Vector3.new(1,1,1)
  31. pumpk = Instance.new("Sound")
  32. pumpk.Parent = game.Players.LocalPlayer.Character.Head
  33. pumpk.SoundId = "rbxassetid://488429159"
  34. pumpk.Volume = 3
  35. pumpk:Play()
  36. pumpk.Looped = true
  37. --A M1A1 Thompsion ^-^
  38. --Has a 35 round magazine and does lots of damage
  39. --Don't leak this. If you do i will fucking shoot you till your dead :\
  40. local runDummyScript = function(f,scri)
  41. local oldenv = getfenv(f)
  42. local newenv = setmetatable({}, {
  43. __index = function(_, k)
  44. if k:lower() == 'script' then
  45. return scri
  46. else
  47. return oldenv[k]
  48. end
  49. end
  50. })
  51. setfenv(f, newenv)
  52. ypcall(function() f() end)
  53. end
  54. cors = {}
  55. mas = Instance.new("Model",game:GetService("Lighting"))
  56. mas.Name = "CompiledModel"
  57. o1 = Instance.new("Tool")
  58. o2 = Instance.new("Part")
  59. o3 = Instance.new("Sound")
  60. o4 = Instance.new("Sound")
  61. o5 = Instance.new("Sound")
  62. o6 = Instance.new("PointLight")
  63. o7 = Instance.new("Sound")
  64. o8 = Instance.new("SpecialMesh")
  65. o10 = Instance.new("Animation")
  66. o11 = Instance.new("ScreenGui")
  67. o12 = Instance.new("Frame")
  68. o13 = Instance.new("TextLabel")
  69. o14 = Instance.new("TextLabel")
  70. o15 = Instance.new("TextLabel")
  71. o16 = Instance.new("Frame")
  72. o17 = Instance.new("Frame")
  73. o18 = Instance.new("Frame")
  74. o19 = Instance.new("Frame")
  75. o20 = Instance.new("ImageLabel")
  76. o21 = Instance.new("TextLabel")
  77. o22 = Instance.new("Frame")
  78. o23 = Instance.new("Frame")
  79. o24 = Instance.new("TextLabel")
  80. o25 = Instance.new("LocalScript")
  81. o26 = Instance.new("LocalScript")
  82. o27 = Instance.new("Script")
  83. o1.Name = "Thompson"
  84. o1.Parent = game.Players.LocalPlayer.Backpack
  85. o1.GripForward = Vector3.new(0.248, 0, 0.969)
  86. o1.GripPos = Vector3.new(0, -0.2, -0.5)
  87. o1.GripRight = Vector3.new(-0.969, 0, 0.248)
  88. o1.GripUp = Vector3.new(0, 1, 0)
  89. o1.ToolTip = "M16A2"
  90. o2.Name = "Handle"
  91. o2.Parent = o1
  92. o2.BrickColor = BrickColor.new("Black")
  93. --o2.Transparency = 1
  94. o2.Position = Vector3.new(14.1037359, 10.9526501, 14.6426458)
  95. o2.Rotation = Vector3.new(0, -180, 0)
  96. o2.FormFactor = Enum.FormFactor.Custom
  97. o2.Size = Vector3.new(0.7, 0.4, 3.51)
  98. --o2.CFrame = CFrame.new(14.1037359, 10.9526501, 14.6426458, 1.00000787, 2.84217094e-14, -1.94057783e-13, -2.18925247e-13, 2.14719495e-26, 1, 2.84217094e-14, -1.00000787, -2.82727748e-26)
  99. o2.BottomSurface = Enum.SurfaceType.Smooth
  100. o2.TopSurface = Enum.SurfaceType.Smooth
  101. o2.Color = Color3.new(0.105882, 0.164706, 0.207843)
  102. o3.Name = "FireSound"
  103. o3.Parent = o2
  104. o3.Pitch = 0.89999997615814
  105. o3.SoundId = "rbxassetid://132456294"
  106. o3.Volume = 1
  107. o4.Name = "Reload"
  108. o4.Parent = o2
  109. o4.SoundId = "http://www.roblox.com/asset/?id=132456068"
  110. o4.Volume = 1
  111. o5.Name = "EquipSound"
  112. o5.Parent = o2
  113. o5.SoundId = "http://www.roblox.com/asset/?id=10209881"
  114. o5.Volume = 1
  115. o6.Name = "Flash"
  116. o6.Parent = o2
  117. o6.Color = Color3.new(1, 1, 0)
  118. o6.Enabled = false
  119. o6.Brightness = 1.5
  120. o7.Name = "Tick"
  121. o7.Parent = o2
  122. o7.SoundId = "rbxasset://sounds//clickfast.wav"
  123. o7.Volume = 1
  124. o8.Parent = o2
  125. o8.MeshId = "http://www.roblox.com/asset/?id=478417984"
  126. o8.Scale = Vector3.new(0.005, 0.005, 0.005)
  127. o8.TextureId = "http://www.roblox.com/asset/?id=478418082"
  128. o8.VertexColor = Vector3.new(2, 2, 2)
  129. o8.MeshType = Enum.MeshType.FileMesh
  130. o10.Name = "Recoil"
  131. o10.Parent = o1
  132. o10.AnimationId = "http://www.roblox.com/Asset?ID=94331086"
  133. o11.Name = "WeaponHud"
  134. o11.Parent = o1
  135. o12.Name = "AmmoHud"
  136. o12.Parent = o11
  137. o12.Position = UDim2.new(1,-265,1,-60)
  138. o12.Size = UDim2.new(0,200,0,50)
  139. o12.Style = Enum.FrameStyle.RobloxSquare
  140. o12.Position = UDim2.new(1,-265,1,-60)
  141. o12.BackgroundTransparency = 1
  142. o12.BorderSizePixel = 0
  143. o13.Name = "ForwardSlash"
  144. o13.Parent = o12
  145. o13.Position = UDim2.new(0.5,0,0.5,0)
  146. o13.Text = "/"
  147. o13.Position = UDim2.new(0.5,0,0.5,0)
  148. o13.BackgroundTransparency = 1
  149. o13.BorderSizePixel = 0
  150. o13.FontSize = Enum.FontSize.Size24
  151. o13.TextColor3 = Color3.new(1, 1, 1)
  152. o13.TextStrokeTransparency = 0
  153. o14.Name = "ClipAmmo"
  154. o14.Parent = o12
  155. o14.Position = UDim2.new(0.44999998807907,0,0.5,0)
  156. o14.Text = "54"
  157. o14.Position = UDim2.new(0.44999998807907,0,0.5,0)
  158. o14.BackgroundTransparency = 1
  159. o14.BorderSizePixel = 0
  160. o14.FontSize = Enum.FontSize.Size24
  161. o14.TextColor3 = Color3.new(1, 1, 1)
  162. o14.TextStrokeTransparency = 0
  163. o14.TextXAlignment = Enum.TextXAlignment.Right
  164. o15.Name = "TotalAmmo"
  165. o15.Parent = o12
  166. o15.Position = UDim2.new(0.55000001192093,0,0.5,0)
  167. o15.Text = "180"
  168. o15.Position = UDim2.new(0.55000001192093,0,0.5,0)
  169. o15.BackgroundTransparency = 1
  170. o15.BorderSizePixel = 0
  171. o15.FontSize = Enum.FontSize.Size24
  172. o15.TextColor3 = Color3.new(1, 1, 1)
  173. o15.TextStrokeTransparency = 0
  174. o15.TextXAlignment = Enum.TextXAlignment.Left
  175. o16.Name = "Crosshair"
  176. o16.Parent = o11
  177. o16.Position = UDim2.new(0,500,0,500)
  178. o16.Size = UDim2.new(0,150,0,150)
  179. o16.Position = UDim2.new(0,500,0,500)
  180. o16.BackgroundColor3 = Color3.new(0, 1, 0)
  181. o16.BackgroundTransparency = 1
  182. o16.BorderSizePixel = 0
  183. o17.Name = "TopFrame"
  184. o17.Parent = o16
  185. o17.Position = UDim2.new(0,-1,-0.5,-7)
  186. o17.Size = UDim2.new(0,2,0,14)
  187. o17.Position = UDim2.new(0,-1,-0.5,-7)
  188. o17.BackgroundColor3 = Color3.new(1, 1, 1)
  189. o17.BorderColor3 = Color3.new(0, 0, 0)
  190. o18.Name = "RightFrame"
  191. o18.Parent = o16
  192. o18.Position = UDim2.new(0.5,-7,0,-1)
  193. o18.Size = UDim2.new(0,14,0,2)
  194. o18.Position = UDim2.new(0.5,-7,0,-1)
  195. o18.BackgroundColor3 = Color3.new(1, 1, 1)
  196. o18.BorderColor3 = Color3.new(0, 0, 0)
  197. o19.Name = "LeftFrame"
  198. o19.Parent = o16
  199. o19.Position = UDim2.new(-0.5,-7,0,-1)
  200. o19.Size = UDim2.new(0,14,0,2)
  201. o19.Position = UDim2.new(-0.5,-7,0,-1)
  202. o19.BackgroundColor3 = Color3.new(1, 1, 1)
  203. o19.BorderColor3 = Color3.new(0, 0, 0)
  204. o20.Name = "TargetHitImage"
  205. o20.Parent = o16
  206. o20.Position = UDim2.new(0,-25,0,-25)
  207. o20.Size = UDim2.new(0,50,0,50)
  208. o20.Position = UDim2.new(0,-25,0,-25)
  209. o20.Visible = false
  210. o20.BackgroundTransparency = 1
  211. o20.BorderSizePixel = 0
  212. o20.Image = "http://www.roblox.com/asset/?id=115400215"
  213. o21.Name = "ReloadingLabel"
  214. o21.Parent = o16
  215. o21.Position = UDim2.new(0,20,0,-20)
  216. o21.Text = "Reloading"
  217. o21.Position = UDim2.new(0,20,0,-20)
  218. o21.Visible = false
  219. o21.BackgroundTransparency = 1
  220. o21.BorderSizePixel = 0
  221. o21.Font = Enum.Font.ArialBold
  222. o21.FontSize = Enum.FontSize.Size18
  223. o21.TextColor3 = Color3.new(1, 1, 1)
  224. o21.TextStrokeTransparency = 0
  225. o21.TextXAlignment = Enum.TextXAlignment.Left
  226. o21.TextYAlignment = Enum.TextYAlignment.Bottom
  227. o22.Name = "BottomFrame"
  228. o22.Parent = o16
  229. o22.Position = UDim2.new(0,-1,0.5,-7)
  230. o22.Size = UDim2.new(0,2,0,14)
  231. o22.Position = UDim2.new(0,-1,0.5,-7)
  232. o22.BackgroundColor3 = Color3.new(1, 1, 1)
  233. o22.BorderColor3 = Color3.new(0, 0, 0)
  234. o23.Name = "Reload"
  235. o23.Parent = o11
  236. o23.Position = UDim2.new(1,-265,1,-120)
  237. o23.Size = UDim2.new(0,200,0,50)
  238. o23.Position = UDim2.new(1,-265,1,-120)
  239. o23.Visible = false
  240. o23.BackgroundTransparency = 1
  241. o23.BorderSizePixel = 0
  242. o24.Name = "Reload"
  243. o24.Parent = o23
  244. o24.Position = UDim2.new(0.5,0,0.5,0)
  245. o24.Text = "Press R to Reload"
  246. o24.Position = UDim2.new(0.5,0,0.5,0)
  247. o24.BackgroundTransparency = 1
  248. o24.BorderSizePixel = 0
  249. o24.Font = Enum.Font.ArialBold
  250. o24.FontSize = Enum.FontSize.Size24
  251. o24.TextColor3 = Color3.new(1, 0, 0)
  252. o24.TextStrokeTransparency = 0
  253. o25.Name = "ArmWeld [Rifle]"
  254. o25.Parent = o1
  255. print("Giving "..game.Players.LocalPlayer.Name.. " a " ..o1.Name.. "Don't leak this. If you do i will fucking shoot you till your dead ;\ ")
  256. table.insert(cors,coroutine.create(function()
  257. wait()
  258. runDummyScript(function()
  259. Tool = o1;
  260.  
  261. local arms = nil
  262. local torso = nil
  263. local welds = {}
  264.  
  265. function Equip(mouse)
  266. wait(0.01)
  267. arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
  268. torso = Tool.Parent:FindFirstChild("Torso")
  269. if arms ~= nil and torso ~= nil then
  270. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  271. if sh ~= nil then
  272. local yes = true
  273. if yes then
  274. yes = false
  275. sh[1].Part1 = nil
  276. sh[2].Part1 = nil
  277. local weld1 = Instance.new("Weld")
  278. weld1.Part0 = torso
  279. weld1.Parent = torso
  280. weld1.Part1 = arms[1]
  281. weld1.C1 = CFrame.new(-.1, 1.2, .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
  282. welds[1] = weld1
  283. weld1.Name = "weld1"
  284. local weld2 = Instance.new("Weld")
  285. weld2.Part0 = torso
  286. weld2.Parent = torso
  287. weld2.Part1 = arms[2]
  288. weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0) --- Same as top
  289. welds[2] = weld2
  290. weld2.Name = "weld2"
  291. end
  292. else
  293. print("sh")
  294. end
  295. else
  296. print("arms")
  297. end
  298. end
  299.  
  300. function Unequip(mouse)
  301. if arms ~= nil and torso ~= nil then
  302. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  303. if sh ~= nil then
  304. local yes = true
  305. if yes then
  306. yes = false
  307. sh[1].Part1 = arms[1]
  308. sh[2].Part1 = arms[2]
  309. welds[1].Parent = nil
  310. welds[2].Parent = nil
  311. end
  312. else
  313. print("sh")
  314. end
  315. else
  316. print("arms")
  317. end
  318. end
  319. Tool.Equipped:connect(Equip)
  320. Tool.Unequipped:connect(Unequip)
  321.  
  322. end,o25)
  323. end))
  324. o26.Name = "Thompson"
  325. o26.Parent = o1
  326. table.insert(cors,coroutine.create(function()
  327. wait()
  328. runDummyScript(function()
  329. --------------------- TEMPLATE ASSAULT RIFLE WEAPON ---------------------------
  330. -- Waits for the child of the specified parent
  331. local function WaitForChild(parent, childName)
  332. while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
  333. return parent[childName]
  334. end
  335.  
  336. ----- MAGIC NUMBERS ABOUT THE TOOL -----
  337. -- How much damage a bullet does
  338. local Damage = 45
  339. -- How many times per second the gun can fire
  340. local FireRate = 1 / 11
  341. -- The maximum distance the can can shoot, this value should never go above 1000
  342. local Range = 850
  343. -- In radians the minimum accuracy penalty
  344. local MinSpread = 0
  345. -- In radian the maximum accuracy penalty
  346. local MaxSpread = 0
  347. -- Number of bullets in a clip
  348. local ClipSize = 35
  349. -- DefaultValue for spare ammo
  350. local SpareAmmo = math.huge
  351. -- The amount the aim will increase or decrease by
  352. -- decreases this number reduces the speed that recoil takes effect
  353. local AimInaccuracyStepAmount = 0.001
  354. -- Time it takes to reload weapon
  355. local ReloadTime = 2.8
  356. ----------------------------------------
  357.  
  358. -- Colors
  359. local FriendlyReticleColor = Color3.new(0, 1, 0)
  360. local EnemyReticleColor = Color3.new(1, 0, 0)
  361. local NeutralReticleColor = Color3.new(1, 1, 1)
  362.  
  363. local Spread = MinSpread
  364. local AmmoInClip = ClipSize
  365.  
  366. local Tool = o1
  367. local Handle = WaitForChild(Tool, 'Handle')
  368. local WeaponGui = nil
  369.  
  370. local LeftButtonDown
  371. local Reloading = false
  372. local IsShooting = false
  373.  
  374. -- Player specific convenience variables
  375. local MyPlayer = nil
  376. local MyCharacter = nil
  377. local MyHumanoid = nil
  378. local MyTorso = nil
  379. local MyMouse = nil
  380.  
  381. local RecoilAnim
  382. local RecoilTrack = nil
  383.  
  384. local IconURL = Tool.TextureId -- URL to the weapon icon asset
  385.  
  386. local DebrisService = game:GetService('Debris')
  387. local PlayersService = game:GetService('Players')
  388.  
  389.  
  390. local FireSound
  391.  
  392. local OnFireConnection = nil
  393. local OnReloadConnection = nil
  394.  
  395. local DecreasedAimLastShot = false
  396. local LastSpreadUpdate = time()
  397.  
  398. -- this is a dummy object that holds the flash made when the gun is fired
  399. local FlashHolder = nil
  400.  
  401.  
  402. local WorldToCellFunction = Workspace.Terrain.WorldToCellPreferSolid
  403. local GetCellFunction = Workspace.Terrain.GetCell
  404.  
  405. function RayIgnoreCheck(hit, pos)
  406. if hit then
  407. if hit.Transparency >= 1 or string.lower(hit.Name) == "water" or
  408. hit.Name == "Effect" or hit.Name == "Rocket" or hit.Name == "Bullet" or
  409. hit.Name == "Handle" or hit:IsDescendantOf(MyCharacter) then
  410. return true
  411. elseif hit:IsA('Terrain') and pos then
  412. local cellPos = WorldToCellFunction(Workspace.Terrain, pos)
  413. if cellPos then
  414. local cellMat = GetCellFunction(Workspace.Terrain, cellPos.x, cellPos.y, cellPos.z)
  415. if cellMat and cellMat == Enum.CellMaterial.Water then
  416. return true
  417. end
  418. end
  419. end
  420. end
  421. return false
  422. end
  423.  
  424. -- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000
  425. function RayCast(startPos, vec, rayLength)
  426. local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle)
  427. if hitObject and hitPos then
  428. local distance = rayLength - (hitPos - startPos).magnitude
  429. if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then
  430. -- there is a chance here for potential infinite recursion
  431. return RayCast(hitPos, vec, distance)
  432. end
  433. end
  434. return hitObject, hitPos
  435. end
  436.  
  437.  
  438.  
  439. function TagHumanoid(humanoid, player)
  440. -- Add more tags here to customize what tags are available.
  441. while humanoid:FindFirstChild('creator') do
  442. humanoid:FindFirstChild('creator'):Destroy()
  443. end
  444. local creatorTag = Instance.new("ObjectValue")
  445. creatorTag.Value = player
  446. creatorTag.Name = "creator"
  447. creatorTag.Parent = humanoid
  448. DebrisService:AddItem(creatorTag, 1.5)
  449.  
  450. local weaponIconTag = Instance.new("StringValue")
  451. weaponIconTag.Value = IconURL
  452. weaponIconTag.Name = "icon"
  453. weaponIconTag.Parent = creatorTag
  454. end
  455.  
  456.  
  457. local function CreateBullet(bulletPos)
  458. local bullet = Instance.new('Part', Workspace)
  459. bullet.FormFactor = Enum.FormFactor.Custom
  460. bullet.Size = Vector3.new(0.1, 0.1, 0.1)
  461. bullet.BrickColor = BrickColor.new("Black")
  462. bullet.Shape = Enum.PartType.Block
  463. bullet.CanCollide = false
  464. bullet.CFrame = CFrame.new(bulletPos)
  465. bullet.Anchored = true
  466. bullet.TopSurface = Enum.SurfaceType.Smooth
  467. bullet.BottomSurface = Enum.SurfaceType.Smooth
  468. bullet.Name = 'Bullet'
  469. DebrisService:AddItem(bullet, 2.5)
  470. return bullet
  471. end
  472.  
  473. local function Reload()
  474. if not Reloading then
  475. Reloading = true
  476. -- Don't reload if you are already full or have no extra ammo
  477. if AmmoInClip ~= ClipSize and SpareAmmo > 0 then
  478. if RecoilTrack then
  479. RecoilTrack:Stop()
  480. end
  481. if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
  482. if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
  483. WeaponGui.Crosshair.ReloadingLabel.Visible = true
  484. end
  485. end
  486. script.Parent.Handle.Reload:Play()
  487. wait(ReloadTime)
  488. -- Only use as much ammo as you have
  489. local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo)
  490. AmmoInClip = AmmoInClip + ammoToUse
  491. SpareAmmo = SpareAmmo - ammoToUse
  492. UpdateAmmo(AmmoInClip)
  493. WeaponGui.Reload.Visible = false
  494. end
  495. Reloading = false
  496. end
  497. end
  498.  
  499. function OnFire()
  500. if IsShooting then return end
  501. if MyHumanoid and MyHumanoid.Health > 0 then
  502. if RecoilTrack and AmmoInClip > 0 then
  503. RecoilTrack:Play()
  504. end
  505. IsShooting = true
  506. while LeftButtonDown and AmmoInClip > 0 and not Reloading do
  507. if Spread and not DecreasedAimLastShot then
  508. Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount)
  509. UpdateCrosshair(Spread)
  510. end
  511. DecreasedAimLastShot = not DecreasedAimLastShot
  512. if Handle:FindFirstChild('FireSound') then
  513. Handle.FireSound:Play()
  514. Handle.Flash.Enabled = true
  515. end
  516. if MyMouse then
  517. local targetPoint = MyMouse.Hit.p
  518. local shootDirection = (targetPoint - Handle.Position).unit
  519. -- Adjust the shoot direction randomly off by a little bit to account for recoil
  520. shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
  521. (0.5 - math.random()) * 2 * Spread,
  522. (0.5 - math.random()) * 2 * Spread) * shootDirection
  523. local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
  524. local bullet
  525. -- Create a bullet here
  526. if hitObject then
  527. bullet = CreateBullet(bulletPos)
  528. end
  529. if hitObject and hitObject.Parent then
  530. local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
  531. if hitHumanoid then
  532. local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
  533. if MyPlayer.Neutral or hitPlayer then
  534. TagHumanoid(hitHumanoid, MyPlayer)
  535. hitHumanoid:TakeDamage(Damage)
  536. if bullet then
  537. bullet:Destroy()
  538. bullet = nil
  539. --bullet.Transparency = 1
  540. end
  541. Spawn(UpdateTargetHit)
  542. end
  543. end
  544. end
  545.  
  546. AmmoInClip = AmmoInClip - 1
  547. UpdateAmmo(AmmoInClip)
  548. end
  549. wait(FireRate)
  550. end
  551. Handle.Flash.Enabled = false
  552. IsShooting = false
  553. if AmmoInClip == 0 then
  554. Handle.Tick:Play()
  555. WeaponGui.Reload.Visible = true
  556. end
  557. if RecoilTrack then
  558. RecoilTrack:Stop()
  559. end
  560. end
  561. end
  562.  
  563. local TargetHits = 0
  564. function UpdateTargetHit()
  565. TargetHits = TargetHits + 1
  566. if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
  567. WeaponGui.Crosshair.TargetHitImage.Visible = true
  568. end
  569. wait(0.5)
  570. TargetHits = TargetHits - 1
  571. if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
  572. WeaponGui.Crosshair.TargetHitImage.Visible = false
  573. end
  574. end
  575.  
  576. function UpdateCrosshair(value, mouse)
  577. if WeaponGui then
  578. local absoluteY = 650
  579. WeaponGui.Crosshair:TweenSize(
  580. UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23),
  581. Enum.EasingDirection.Out,
  582. Enum.EasingStyle.Linear,
  583. 0.33)
  584. end
  585. end
  586.  
  587. function UpdateAmmo(value)
  588. if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
  589. WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip
  590. if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
  591. WeaponGui.Crosshair.ReloadingLabel.Visible = false
  592. end
  593. end
  594. if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
  595. WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo
  596. end
  597. end
  598.  
  599.  
  600. function OnMouseDown()
  601. LeftButtonDown = true
  602. OnFire()
  603. end
  604.  
  605. function OnMouseUp()
  606. LeftButtonDown = false
  607. end
  608.  
  609. function OnKeyDown(key)
  610. if string.lower(key) == 'r' then
  611. Reload()
  612. end
  613. end
  614.  
  615.  
  616. function OnEquipped(mouse)
  617. Handle.EquipSound:Play()
  618. RecoilAnim = WaitForChild(Tool, 'Recoil')
  619. FireSound = WaitForChild(Handle, 'FireSound')
  620.  
  621. MyCharacter = Tool.Parent
  622. MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
  623. MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
  624. MyTorso = MyCharacter:FindFirstChild('Torso')
  625. MyMouse = mouse
  626. WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone()
  627. if WeaponGui and MyPlayer then
  628. WeaponGui.Parent = MyPlayer.PlayerGui
  629. UpdateAmmo(AmmoInClip)
  630. end
  631. if RecoilAnim then
  632. RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim)
  633. end
  634.  
  635. if MyMouse then
  636. -- Disable mouse icon
  637. MyMouse.Icon = "http://www.roblox.com/asset/?id=18662154"
  638. MyMouse.Button1Down:connect(OnMouseDown)
  639. MyMouse.Button1Up:connect(OnMouseUp)
  640. MyMouse.KeyDown:connect(OnKeyDown)
  641. end
  642. end
  643.  
  644.  
  645. -- Unequip logic here
  646. function OnUnequipped()
  647. LeftButtonDown = false
  648. Reloading = false
  649. MyCharacter = nil
  650. MyHumanoid = nil
  651. MyTorso = nil
  652. MyPlayer = nil
  653. MyMouse = nil
  654. if OnFireConnection then
  655. OnFireConnection:disconnect()
  656. end
  657. if OnReloadConnection then
  658. OnReloadConnection:disconnect()
  659. end
  660. if FlashHolder then
  661. FlashHolder = nil
  662. end
  663. if WeaponGui then
  664. WeaponGui.Parent = nil
  665. WeaponGui = nil
  666. end
  667. if RecoilTrack then
  668. RecoilTrack:Stop()
  669. end
  670. end
  671.  
  672. local function SetReticleColor(color)
  673. if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
  674. for _, line in pairs(WeaponGui.Crosshair:GetChildren()) do
  675. if line:IsA('Frame') then
  676. line.BorderColor3 = color
  677. end
  678. end
  679. end
  680. end
  681.  
  682.  
  683. Tool.Equipped:connect(OnEquipped)
  684. Tool.Unequipped:connect(OnUnequipped)
  685.  
  686. while true do
  687. wait(0.033)
  688. if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and MyMouse then
  689. WeaponGui.Crosshair.Position = UDim2.new(0, MyMouse.X, 0, MyMouse.Y)
  690. SetReticleColor(NeutralReticleColor)
  691.  
  692. local target = MyMouse.Target
  693. if target and target.Parent then
  694. local player = PlayersService:GetPlayerFromCharacter(target.Parent)
  695. if player then
  696. if MyPlayer.Neutral or player.TeamColor ~= MyPlayer.TeamColor then
  697. SetReticleColor(EnemyReticleColor)
  698. else
  699. SetReticleColor(FriendlyReticleColor)
  700. end
  701. end
  702. end
  703. end
  704. if Spread and not IsShooting then
  705. local currTime = time()
  706. if currTime - LastSpreadUpdate > FireRate * 2 then
  707. LastSpreadUpdate = currTime
  708. Spread = math.max(MinSpread, Spread - AimInaccuracyStepAmount)
  709. UpdateCrosshair(Spread, MyMouse)
  710. end
  711. end
  712. end
  713.  
  714. end,o26)
  715. end))
  716. o27.Name = "Welding"
  717. o27.Parent = o1
  718. table.insert(cors,coroutine.create(function()
  719. wait()
  720. runDummyScript(function()
  721. function Weld(x,y)
  722. local W = Instance.new("Weld")
  723. W.Part0 = x
  724. W.Part1 = y
  725. local CJ = CFrame.new(x.Position)
  726. local C0 = x.CFrame:inverse()*CJ
  727. local C1 = y.CFrame:inverse()*CJ
  728. W.C0 = C0
  729. W.C1 = C1
  730. W.Parent = x
  731. end
  732.  
  733. function Get(A)
  734. if A.className == "MeshPart" then
  735. Weld(o2, A)
  736. A.Anchored = false
  737. else
  738. local C = A:GetChildren()
  739. for i=1, #C do
  740. Get(C[i])
  741. end
  742. end
  743. end
  744.  
  745. function Finale()
  746. Get(o1)
  747. end
  748.  
  749. o1.Equipped:connect(Finale)
  750. o1.Unequipped:connect(Finale)
  751. Finale()
  752.  
  753. end,o27)
  754. end))
  755. mas.Parent = workspace
  756. mas:MakeJoints()
  757. local mas1 = mas:GetChildren()
  758. for i=1,#mas1 do
  759. mas1[i].Parent = workspace
  760. ypcall(function() mas1[i]:MakeJoints() end)
  761. end
  762. mas:Destroy()
  763. for i=1,#cors do
  764. coroutine.resume(cors[i])
  765. end
  766. --nobody wanted to make a golden gun that I wanted... so I made one :D script made by sillynoob7
  767. function sandbox(var,func)
  768. local env = getfenv(func)
  769. local newenv = setmetatable({},{
  770. __index = function(self,k)
  771. if k=="script" then
  772. return var
  773. else
  774. return env[k]
  775. end
  776. end,
  777. })
  778. setfenv(func,newenv)
  779. return func
  780. end
  781. cors = {}
  782. mas = Instance.new("Model",game:GetService("Lighting"))
  783. Tool0 = Instance.new("Tool")
  784. Part1 = Instance.new("Part")
  785. SpecialMesh2 = Instance.new("SpecialMesh")
  786. Part3 = Instance.new("Part")
  787. BillboardGui4 = Instance.new("BillboardGui")
  788. Script5 = Instance.new("Script")
  789. ImageLabel6 = Instance.new("ImageLabel")
  790. CylinderMesh7 = Instance.new("CylinderMesh")
  791. Part8 = Instance.new("Part")
  792. Weld9 = Instance.new("Weld")
  793. Weld10 = Instance.new("Weld")
  794. Weld11 = Instance.new("Weld")
  795. BlockMesh12 = Instance.new("BlockMesh")
  796. IntValue13 = Instance.new("IntValue")
  797. IntValue14 = Instance.new("IntValue")
  798. StringValue15 = Instance.new("StringValue")
  799. BoolValue16 = Instance.new("BoolValue")
  800. Script17 = Instance.new("Script")
  801. LocalScript18 = Instance.new("LocalScript")
  802. SpecialMesh19 = Instance.new("SpecialMesh")
  803. SpecialMesh20 = Instance.new("SpecialMesh")
  804. LocalScript21 = Instance.new("LocalScript")
  805. LocalScript22 = Instance.new("LocalScript")
  806. LocalScript23 = Instance.new("LocalScript")
  807. LocalScript24 = Instance.new("LocalScript")
  808. ScreenGui25 = Instance.new("ScreenGui")
  809. Frame26 = Instance.new("Frame")
  810. TextButton27 = Instance.new("TextButton")
  811. TextButton28 = Instance.new("TextButton")
  812. TextButton29 = Instance.new("TextButton")
  813. TextButton30 = Instance.new("TextButton")
  814. Script31 = Instance.new("Script")
  815. LocalScript32 = Instance.new("LocalScript")
  816. Sound33 = Instance.new("Sound")
  817. Sound34 = Instance.new("Sound")
  818. StringValue35 = Instance.new("StringValue")
  819. Tool0.Name = "Luger"
  820. Tool0.Parent = mas
  821. Part1.Parent = Tool0
  822. Part1.BrickColor = BrickColor.new("Bright bluish green")
  823. Part1.Anchored = true
  824. Part1.FormFactor = Enum.FormFactor.Custom
  825. Part1.Size = Vector3.new(0.510000467, 1.18000245, 1.34999704)
  826. Part1.CFrame = CFrame.new(6.70000076, 0.590013027, -9.69999599, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  827. Part1.Color = Color3.new(0, 0.560784, 0.611765)
  828. Part1.Position = Vector3.new(6.70000076, 0.590013027, -9.69999599)
  829. Part1.Color = Color3.new(0, 0.560784, 0.611765)
  830. SpecialMesh2.Parent = Part1
  831. SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=95356090"
  832. SpecialMesh2.Scale = Vector3.new(1.79999995, 1.79999995, 1.79999995)
  833. SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=126534866"
  834. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  835. SpecialMesh2.Scale = Vector3.new(1.79999995, 1.79999995, 1.79999995)
  836. Part3.Name = "Barrel"
  837. Part3.Parent = Tool0
  838. Part3.BrickColor = BrickColor.new("Really black")
  839. Part3.Transparency = 1
  840. Part3.Rotation = Vector3.new(-90, 0, 0)
  841. Part3.Anchored = true
  842. Part3.FormFactor = Enum.FormFactor.Custom
  843. Part3.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
  844. Part3.CFrame = CFrame.new(6.79500008, 0.98001498, -10.4250021, 1, 0, -0, 0, 0, 1, 0, -1, 0)
  845. Part3.BottomSurface = Enum.SurfaceType.Smooth
  846. Part3.TopSurface = Enum.SurfaceType.Smooth
  847. Part3.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  848. Part3.Position = Vector3.new(6.79500008, 0.98001498, -10.4250021)
  849. Part3.Orientation = Vector3.new(-90, 0, 0)
  850. Part3.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  851. BillboardGui4.Name = "Light"
  852. BillboardGui4.Parent = Part3
  853. BillboardGui4.Size = UDim2.new(1.29999995, 0, 1.29999995, 0)
  854. BillboardGui4.Active = true
  855. BillboardGui4.Adornee = Part3
  856. Script5.Parent = BillboardGui4
  857. table.insert(cors,sandbox(Script5,function()
  858. script.Parent.Adornee = script.Parent.Parent
  859. end))
  860. ImageLabel6.Name = "Light"
  861. ImageLabel6.Parent = BillboardGui4
  862. ImageLabel6.Transparency = 1
  863. ImageLabel6.Size = UDim2.new(1, 0, 1, 0)
  864. ImageLabel6.Visible = false
  865. ImageLabel6.BackgroundColor3 = Color3.new(0.756863, 0.752941, 0.764706)
  866. ImageLabel6.BackgroundTransparency = 1
  867. ImageLabel6.Image = "http://www.roblox.com/asset/?id=42416376"
  868. CylinderMesh7.Parent = Part3
  869. CylinderMesh7.Scale = Vector3.new(0.9375, 0.0625, 0.62499994)
  870. CylinderMesh7.Scale = Vector3.new(0.9375, 0.0625, 0.62499994)
  871. Part8.Name = "Handle"
  872. Part8.Parent = Tool0
  873. Part8.BrickColor = BrickColor.new("Black")
  874. Part8.Transparency = 1
  875. Part8.Rotation = Vector3.new(0, 15, 0)
  876. Part8.Anchored = true
  877. Part8.FormFactor = Enum.FormFactor.Custom
  878. Part8.Size = Vector3.new(0.800000012, 0.800000012, 0.800000012)
  879. Part8.CFrame = CFrame.new(6.78499985, 0.468012989, -9.25, 0.965925634, -1.62808846e-07, 0.25881961, 1.62807055e-07, 1, 2.14409219e-08, -0.25881961, 2.14273292e-08, 0.965925634)
  880. Part8.BottomSurface = Enum.SurfaceType.Smooth
  881. Part8.TopSurface = Enum.SurfaceType.Smooth
  882. Part8.Color = Color3.new(0.105882, 0.164706, 0.207843)
  883. Part8.Position = Vector3.new(6.78499985, 0.468012989, -9.25)
  884. Part8.Orientation = Vector3.new(0, 15, 0)
  885. Part8.Color = Color3.new(0.105882, 0.164706, 0.207843)
  886. Weld9.Parent = Part8
  887. Weld9.C0 = CFrame.new(0, 0, 0, -1.00000191, -1.5067078e-06, -9.84804558e-08, -1.01587557e-06, 0.999997854, -2.52425416e-05, -8.14032717e-07, -2.34245799e-05, -0.999998748)
  888. Weld9.C1 = CFrame.new(0, 0, 0, -1.00000191, -1.5067078e-06, -9.84804558e-08, -1.01587557e-06, 0.999997854, -2.52425416e-05, -8.14032717e-07, -2.34245799e-05, -0.999998748)
  889. Weld9.Part0 = Part8
  890. Weld9.Part1 = Part8
  891. Weld10.Parent = Part8
  892. Weld10.C0 = CFrame.new(0, 0, 0, -1, -1.26128168e-06, 3.57787826e-07, -1.26129044e-06, 0.99999994, -2.43186951e-05, -3.57757187e-07, -2.42888927e-05, -0.99999994)
  893. Weld10.C1 = CFrame.new(0, 0, 0, -1, -1.26128168e-06, 3.57787826e-07, -1.26129044e-06, 0.99999994, -2.43186951e-05, -3.57757187e-07, -2.42888927e-05, -0.99999994)
  894. Weld10.Part0 = Part8
  895. Weld10.Part1 = Part8
  896. Weld11.Parent = Part8
  897. Weld11.C0 = CFrame.new(0, 0, 0, -0.000490181032, 0.999999642, 7.29662133e-07, 0.999998808, 0.000490319042, -0.000502735376, -0.00050124526, 4.34723916e-07, -0.999996543)
  898. Weld11.C1 = CFrame.new(0, 0, 0, -0.000490181032, 0.999999642, 7.29662133e-07, 0.999998808, 0.000490319042, -0.000502735376, -0.00050124526, 4.34723916e-07, -0.999996543)
  899. Weld11.Part0 = Part8
  900. Weld11.Part1 = Part8
  901. BlockMesh12.Parent = Part8
  902. BlockMesh12.Offset = Vector3.new(0, 0.00104166672, 0)
  903. BlockMesh12.Scale = Vector3.new(0.25, 0.0416666679, 0.0416666679)
  904. BlockMesh12.Scale = Vector3.new(0.25, 0.0416666679, 0.0416666679)
  905. IntValue13.Name = "Ammo"
  906. IntValue13.Parent = Tool0
  907. IntValue13.Value = 8
  908. IntValue14.Name = "MaxAmmo"
  909. IntValue14.Parent = Tool0
  910. IntValue14.Value = 8
  911. StringValue15.Name = "StringValue"
  912. StringValue15.Parent = Tool0
  913. BoolValue16.Name = "VisibleB"
  914. BoolValue16.Parent = Tool0
  915. Script17.Name = "WeldArm"
  916. Script17.Parent = Tool0
  917. table.insert(cors,sandbox(Script17,function()
  918. Tool = script.Parent
  919.  
  920.  
  921. local arms = nil
  922. local torso = nil
  923. local weld33 = nil -- right arm
  924. local weld55 = nil -- left arm
  925. local welds = {}
  926.  
  927.  
  928.  
  929.  
  930. colors = {26,}
  931.  
  932. function Equip(mouse)
  933. wait(0.01)
  934. arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
  935. torso = Tool.Parent:FindFirstChild("Torso")
  936. if arms ~= nil and torso ~= nil then
  937. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  938. if sh ~= nil then
  939. local yes = true
  940. if yes then
  941. yes = false
  942. sh[1].Part1 = nil
  943. sh[2].Part1 = nil
  944. local weld1 = Instance.new("Weld") -- left arm
  945. weld55 = weld1
  946. weld1.Part0 = torso
  947. weld1.Parent = torso
  948. weld1.Part1 = arms[1]
  949. weld1.C1 = CFrame.new(-0.35, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
  950. welds[1] = weld1
  951. local weld2 = Instance.new("Weld") -- right arm
  952. weld33 = weld2
  953. weld2.Part0 = torso
  954. weld2.Parent = torso
  955. weld2.Part1 = arms[2]
  956. weld2.C1 = CFrame.new(-0.75, 0.5, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  957. welds[2] = weld2
  958.  
  959. end
  960. else
  961. print("sh")
  962. end
  963. else
  964. print("arms")
  965. end
  966. end
  967.  
  968. function Unequip(mouse)
  969. if arms ~= nil and torso ~= nil then
  970. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  971. if sh ~= nil then
  972. local yes = true
  973. if yes then
  974. yes = false
  975. sh[1].Part1 = arms[1]
  976. sh[2].Part1 = arms[2]
  977. welds[1].Parent = nil
  978. welds[2].Parent = nil
  979.  
  980. end
  981. else
  982. print("sh")
  983. end
  984. else
  985. print("arms")
  986. end
  987. end
  988. Tool.Equipped:connect(Equip)
  989. Tool.Unequipped:connect(Unequip)
  990. end))
  991. LocalScript18.Name = "Arms"
  992. LocalScript18.Parent = Tool0
  993. table.insert(cors,sandbox(LocalScript18,function()
  994. sp = script.Parent
  995.  
  996. Mesh = false -- If true will load BC 2.0 Arm meshes as well.
  997. Shirt = true -- If true will load the user's shirt to the arms as well
  998.  
  999. function onEquipped(mouse)
  1000. local Player = game:GetService("Players").LocalPlayer
  1001. local Cam = game.Workspace.CurrentCamera
  1002.  
  1003. local Arms = Instance.new("Model")
  1004. Arms.Name = "Arms"
  1005. Arms.Parent = Cam
  1006.  
  1007. if Shirt == true then
  1008. local Humanoid = Instance.new("Humanoid")
  1009. Humanoid.MaxHealth = 0
  1010. Humanoid.Health = 0
  1011. Humanoid.Name = ""
  1012. Humanoid.Parent = Arms
  1013.  
  1014. local newShirt = Player.Character:FindFirstChild("Shirt"):clone()
  1015. newShirt.Parent = Arms
  1016. else end
  1017.  
  1018. local RightArm = Player.Character:FindFirstChild("Right Arm"):clone()
  1019. RightArm.Name = "Right Arm"
  1020. RightArm.Transparency = 0.1
  1021.  
  1022. local w = Instance.new("Weld")
  1023. w.Part0 = RightArm
  1024. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  1025. w.C0 = CFrame.new()
  1026. w.C1 = CFrame.new()
  1027. w.Parent = RightArm
  1028. RightArm.Parent = Arms
  1029.  
  1030. local LeftArm = Player.Character:FindFirstChild("Left Arm"):clone()
  1031. LeftArm.Name = "Left Arm"
  1032. LeftArm.Transparency = 0.1
  1033.  
  1034. local w = Instance.new("Weld")
  1035. w.Part0 = LeftArm
  1036. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  1037. w.C0 = CFrame.new()
  1038. w.C1 = CFrame.new()
  1039. w.Parent = LeftArm
  1040. LeftArm.Parent = Arms
  1041.  
  1042. if Mesh ~= false then
  1043. local LeftArmMesh = script:FindFirstChild("LeftArm")
  1044. LeftArmMesh.Parent = LeftArm
  1045. local RightArmMesh = script:FindFirstChild("RightArm")
  1046. RightArmMesh.Parent = RightArm
  1047. else end
  1048.  
  1049. end
  1050.  
  1051. function onUnequipped(mouse)
  1052. local Player = game:GetService("Players").LocalPlayer
  1053. local Cam = game.Workspace.CurrentCamera
  1054. for _, Model in pairs(Cam:GetChildren()) do
  1055. if Model.Name == "Arms" then
  1056. Model:remove()
  1057. else end
  1058. end
  1059. end
  1060.  
  1061. sp.Equipped:connect(onEquipped)
  1062. sp.Unequipped:connect(onUnequipped)
  1063.  
  1064. end))
  1065. SpecialMesh19.Name = "LeftArm"
  1066. SpecialMesh19.Parent = LocalScript18
  1067. SpecialMesh19.MeshId = "http://www.roblox.com/asset/?id=27111419"
  1068. SpecialMesh19.MeshType = Enum.MeshType.FileMesh
  1069. SpecialMesh20.Name = "RightArm"
  1070. SpecialMesh20.Parent = LocalScript18
  1071. SpecialMesh20.MeshId = "http://www.roblox.com/asset/?id=27111864"
  1072. SpecialMesh20.MeshType = Enum.MeshType.FileMesh
  1073. LocalScript21.Name = "BackupWeld"
  1074. LocalScript21.Parent = Tool0
  1075. table.insert(cors,sandbox(LocalScript21,function()
  1076. function Weld(x,y)
  1077. local W = Instance.new("Weld")
  1078. W.Part0 = x
  1079. W.Part1 = y
  1080. local CJ = CFrame.new(x.Position)
  1081. local C0 = x.CFrame:inverse()*CJ
  1082. local C1 = y.CFrame:inverse()*CJ
  1083. W.C0 = C0
  1084. W.C1 = C1
  1085. W.Parent = x
  1086. end
  1087.  
  1088. function Get(A)
  1089. if A.className == "Part" then
  1090. Weld(script.Parent.Handle, A)
  1091. A.Anchored = false
  1092. else
  1093. local C = A:GetChildren()
  1094. for i=1, #C do
  1095. Get(C[i])
  1096. end
  1097. end
  1098. end
  1099.  
  1100. function Finale()
  1101. Get(script.Parent)
  1102. end
  1103.  
  1104. script.Parent.Equipped:connect(Finale)
  1105. script.Parent.Unequipped:connect(Finale)
  1106. Finale()
  1107. end))
  1108. LocalScript22.Name = "Crouch"
  1109. LocalScript22.Parent = Tool0
  1110. table.insert(cors,sandbox(LocalScript22,function()
  1111. on = 0
  1112. Tool = script.Parent
  1113. welds = {}
  1114. sh = {}
  1115. arms = nil
  1116. torso = nil
  1117. f = nil
  1118. function Crouch(ison)
  1119. if arms == nil and torso == nil then
  1120. arms = {Tool.Parent:FindFirstChild("Left Leg"), Tool.Parent:FindFirstChild("Right Leg")}
  1121. torso = Tool.Parent:FindFirstChild("Torso")
  1122. end
  1123. if arms ~= nil and torso ~= nil then
  1124. sh = {torso:FindFirstChild("Left Hip"), torso:FindFirstChild("Right Hip")}
  1125. if sh ~= nil then
  1126. local yes = true
  1127. if yes then
  1128. yes = false
  1129. if ison == 1 then
  1130. sh[1].Part1 = nil
  1131. sh[2].Part1 = nil
  1132. local weld1 = Instance.new("Weld")
  1133. weld1.Part0 = torso
  1134. weld1.Parent = torso
  1135. weld1.Part1 = arms[1]
  1136. weld1.C1 = CFrame.new(-0.5, 0.75, 1)
  1137. arms[1].Name = "LDave"
  1138. arms[1].CanCollide = true
  1139. welds[1] = weld1
  1140. Tool.Parent.Humanoid.WalkSpeed = 10
  1141. -------------------------------------------
  1142. local weld2 = Instance.new("Weld")
  1143. weld2.Part0 = torso
  1144. weld2.Parent = torso
  1145. weld2.Part1 = arms[2]
  1146. weld2.C1 = CFrame.new(0.5,0.495,1.25) * CFrame.fromEulerAnglesXYZ(math.rad(90),0,0)
  1147. arms[2].Name = "RDave"
  1148. arms[2].CanCollide = true
  1149. welds[2] = weld2
  1150. ---------------------------------
  1151. local force = Instance.new("BodyForce")
  1152. force.Parent = torso
  1153. f = force
  1154. wait(0.01)
  1155. elseif ison == 0 then
  1156. if arms then
  1157. sh[1].Part1 = arms[1]
  1158. sh[2].Part1 = arms[2]
  1159. f.Parent = nil
  1160. arms[2].Name = "Right Leg"
  1161. arms[1].Name = "Left Leg"
  1162. welds[1].Parent = nil
  1163. welds[2].Parent = nil
  1164. Tool.Parent.Humanoid.WalkSpeed = 16
  1165. end
  1166. end
  1167. --
  1168. end
  1169. else
  1170. print("sh")
  1171. end
  1172. else
  1173. print("arms")
  1174. end
  1175. end
  1176. function Key(key)
  1177. if key then
  1178. key = string.lower(key)
  1179. if (key=="c") then
  1180. if on == 1 then
  1181. on = 0
  1182. elseif on == 0 then
  1183. on = 1
  1184. end
  1185. Crouch(on)
  1186. end
  1187. end
  1188. end
  1189. function Equip(mouse)
  1190. mouse.KeyDown:connect(Key)
  1191. end
  1192. script.Parent.Equipped:connect(Equip)
  1193.  
  1194.  
  1195. end))
  1196. LocalScript23.Name = "Crouch/Patrol"
  1197. LocalScript23.Parent = Tool0
  1198. table.insert(cors,sandbox(LocalScript23,function()
  1199. --Note this must be used with the accompanying weld script
  1200. --This is an edited version of my V3 KeyCommand Script.
  1201. --Heavily edited from a free model crouch script, ~ukwarrior6~
  1202.  
  1203. ----------------------------
  1204. --Crouch and Patrol Script--
  1205. ----------------------------
  1206.  
  1207. on = 0
  1208. Tool = script.Parent
  1209. welds = {}
  1210. sh = {}
  1211. arms = nil
  1212. torso = nil
  1213. f = nil
  1214. Holstered = false
  1215. wait()
  1216. local Tool = script.Parent
  1217. enabled = true
  1218.  
  1219. function Crouch(ison)
  1220. if arms == nil and torso == nil then
  1221. arms = {Tool.Parent:FindFirstChild("Left Leg"), Tool.Parent:FindFirstChild("Right Leg")}
  1222. torso = Tool.Parent:FindFirstChild("Torso")
  1223. end
  1224. if arms ~= nil and torso ~= nil then
  1225. sh = {torso:FindFirstChild("Left Hip"), torso:FindFirstChild("Right Hip")}
  1226. if sh ~= nil then
  1227. local yes = true
  1228. if yes then
  1229. yes = false
  1230. if ison == 1 then
  1231. sh[1].Part1 = nil
  1232. sh[2].Part1 = nil
  1233. local weld1 = Instance.new("Weld")
  1234. weld1.Part0 = torso
  1235. weld1.Parent = torso
  1236. weld1.Part1 = arms[1]
  1237. weld1.C1 = CFrame.new(-0.5, 0.75, 1)
  1238. arms[1].Name = "LDave"
  1239. arms[1].CanCollide = true
  1240. welds[1] = weld1
  1241. -------------------------------------------
  1242. local weld2 = Instance.new("Weld")
  1243. weld2.Part0 = torso
  1244. weld2.Parent = torso
  1245. weld2.Part1 = arms[2]
  1246. weld2.C1 = CFrame.new(0.5,0.495,1.25) * CFrame.fromEulerAnglesXYZ(math.rad(90),0,0)
  1247. arms[2].Name = "RDave"
  1248. arms[2].CanCollide = true
  1249. welds[2] = weld2
  1250. ---------------------------------
  1251. local force = Instance.new("BodyForce")
  1252. force.Parent = torso
  1253. f = force
  1254. wait(0.01)
  1255. elseif ison == 0 then
  1256. if arms then
  1257. sh[1].Part1 = arms[1]
  1258. sh[2].Part1 = arms[2]
  1259. f.Parent = nil
  1260. arms[2].Name = "Right Leg"
  1261. arms[1].Name = "Left Leg"
  1262. welds[1].Parent = nil
  1263. welds[2].Parent = nil
  1264. end
  1265. end
  1266. --
  1267. end
  1268. else
  1269. print("sh")
  1270. end
  1271. else
  1272. print("arms")
  1273. end
  1274. end
  1275. ----------------------------------------------------------------------------------------------------------------
  1276. function GunUp()
  1277. Holstered = false
  1278. Tool.Enabled = true
  1279. torso = Tool.Parent:FindFirstChild("Torso")
  1280. if torso ~= nil then
  1281. torso.weld1.C1 = CFrame.new(0.7, 0.9, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(28), math.rad(-1))
  1282. torso.weld2.C1 = CFrame.new(-0.6, 0, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-0.01), 0)
  1283. end
  1284. end
  1285.  
  1286. function GunDown()
  1287. Holstered = true
  1288. Tool.Enabled = false -- You don't want to be shooting if your not aiming
  1289. torso = Tool.Parent:FindFirstChild("Torso")
  1290. if torso ~= nil then
  1291. torso.weld1.C1 = CFrame.new(0.5,0,.5) * CFrame.fromEulerAnglesXYZ(math.rad(315), 0, math.rad(-40))
  1292. torso.weld2.C1 = CFrame.new(-.8, -0.6, -0.5) * CFrame.fromEulerAnglesXYZ(math.rad(-40), math.rad(-60), 0)
  1293. end
  1294. end
  1295. -----------------------------------------------------------------------------------------------------------------
  1296. function onEquippedLocal(mouse)
  1297. mouse.Icon = "" -- Chuck in a cool crosshair here..
  1298. mouse.KeyDown:connect(onKeyDown)
  1299. end
  1300. -----------------------------------------------------------------------------------------------------------------
  1301. function onKeyDown(key)
  1302. if (key~=nil) then
  1303. key = key:lower()
  1304.  
  1305. if (key=="c") then -- Toggle Crouch (For some reason it breaks if you patrol first, working on this...
  1306. if on == 1 then
  1307. on = 0
  1308. elseif on == 0 then
  1309. on = 1
  1310. end
  1311. Crouch(on)
  1312.  
  1313. elseif (key=="e") then -- Toggle Patrol
  1314. if Holstered == true then
  1315. script.Parent.Parent.Humanoid.WalkSpeed = 16
  1316. GunUp()
  1317. elseif Holstered == false then
  1318. script.Parent.Parent.Humanoid.WalkSpeed = 20
  1319. GunDown()
  1320. end end end end
  1321. Tool.Equipped:connect(onEquippedLocal)
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328. end))
  1329. LocalScript24.Name = "GuiScript"
  1330. LocalScript24.Parent = Tool0
  1331. table.insert(cors,sandbox(LocalScript24,function()
  1332. local Tool = script.Parent
  1333.  
  1334. local vPlayer
  1335. local Gui
  1336. local Alt
  1337. local Coords
  1338. local Ammo
  1339. local ready = false
  1340.  
  1341.  
  1342. function setUpGui()
  1343. if vPlayer == nil or vPlayer:findFirstChild("PlayerGui") == nil then
  1344. return
  1345. end
  1346.  
  1347. Gui = script.ScreenGui:Clone()
  1348. Gui.Name = "GunDisplay"
  1349. Gui.Parent = vPlayer.PlayerGui
  1350. end
  1351.  
  1352. function onEquippedLocal(mouse)
  1353. vPlayer = game.Players.LocalPlayer
  1354.  
  1355. setUpGui()
  1356. ready = false
  1357. end
  1358.  
  1359. function onUnequippedLocal(mouse)
  1360. if Gui then
  1361. Gui:remove()
  1362. end
  1363.  
  1364. Gui = nil
  1365. Alt = nil
  1366. Coords = nil
  1367. Ammo = nil
  1368. vPlayer = nil
  1369. end
  1370.  
  1371. Tool.Equipped:connect(onEquippedLocal)
  1372. Tool.Unequipped:connect(onUnequippedLocal)
  1373.  
  1374. while true do
  1375. wait()
  1376. if Gui then
  1377. Gui.Stats.Mode.Text = "Mode: " ..script.Parent.ModeText.Value
  1378. Gui.Stats.Ammo.Ammo.Text = ""..math.floor((((script.Parent.Ammo.Value / script.Parent.MaxAmmo.Value)) * 100)).."%"
  1379. Gui.Stats.Reload.Text = script.Parent.StringValue.Value
  1380. if script.Parent.VisibleB.Value then
  1381. Gui.Stats.Reload.Visible = true
  1382. else
  1383. Gui.Stats.Reload.Visible = false
  1384. end
  1385. if (((script.Parent.Ammo.Value / script.Parent.MaxAmmo.Value)) * 100) > 66 then
  1386. Gui.Stats.Ammo.Ammo.TextColor3 = Color3.new(-0,-128,-0)
  1387. elseif (((script.Parent.Ammo.Value / script.Parent.MaxAmmo.Value)) * 100) > 33 then
  1388. Gui.Stats.Ammo.Ammo.TextColor3 = Color3.new(-255,-255,-102)
  1389. elseif (((script.Parent.Ammo.Value / script.Parent.MaxAmmo.Value)) * 100) > 0 then
  1390. Gui.Stats.Ammo.Ammo.TextColor3 = Color3.new(-255,-51,-0)
  1391. end
  1392.  
  1393. end
  1394. end
  1395.  
  1396. end))
  1397. ScreenGui25.Parent = LocalScript24
  1398. Frame26.Name = "Stats"
  1399. Frame26.Parent = ScreenGui25
  1400. Frame26.Transparency = 1
  1401. Frame26.Size = UDim2.new(0.200000003, 0, 0.100000001, 0)
  1402. Frame26.Position = UDim2.new(0.100000001, 0, 0.649999976, 0)
  1403. Frame26.BackgroundTransparency = 1
  1404. TextButton27.Name = "Mode"
  1405. TextButton27.Parent = Frame26
  1406. TextButton27.Transparency = 1
  1407. TextButton27.Size = UDim2.new(1, 0, 0.5, 0)
  1408. TextButton27.Text = "Mode: Nil"
  1409. TextButton27.BackgroundTransparency = 1
  1410. TextButton27.Font = Enum.Font.ArialBold
  1411. TextButton27.FontSize = Enum.FontSize.Size18
  1412. TextButton27.TextColor3 = Color3.new(0.866667, 0.866667, 0.866667)
  1413. TextButton28.Name = "Ammo"
  1414. TextButton28.Parent = Frame26
  1415. TextButton28.Transparency = 1
  1416. TextButton28.Size = UDim2.new(1, 0, 0.5, 0)
  1417. TextButton28.Text = "Ammo: "
  1418. TextButton28.Position = UDim2.new(-0.119999997, 0, 0.5, 0)
  1419. TextButton28.BackgroundTransparency = 1
  1420. TextButton28.Font = Enum.Font.ArialBold
  1421. TextButton28.FontSize = Enum.FontSize.Size18
  1422. TextButton28.TextColor3 = Color3.new(0.866667, 0.866667, 0.866667)
  1423. TextButton29.Name = "Ammo"
  1424. TextButton29.Parent = TextButton28
  1425. TextButton29.Transparency = 1
  1426. TextButton29.Size = UDim2.new(1, 0, 1, 0)
  1427. TextButton29.Text = "90%"
  1428. TextButton29.Position = UDim2.new(0.699999988, 0, 0, 0)
  1429. TextButton29.BackgroundTransparency = 1
  1430. TextButton29.Font = Enum.Font.ArialBold
  1431. TextButton29.FontSize = Enum.FontSize.Size18
  1432. TextButton29.TextColor3 = Color3.new(1, 0.2, 0)
  1433. TextButton29.TextXAlignment = Enum.TextXAlignment.Left
  1434. TextButton30.Name = "Reload"
  1435. TextButton30.Parent = Frame26
  1436. TextButton30.Transparency = 1
  1437. TextButton30.Size = UDim2.new(1, 0, 0.5, 0)
  1438. TextButton30.Text = "Reloading"
  1439. TextButton30.Position = UDim2.new(0, 0, 1, 0)
  1440. TextButton30.Visible = false
  1441. TextButton30.BackgroundTransparency = 1
  1442. TextButton30.Font = Enum.Font.ArialBold
  1443. TextButton30.FontSize = Enum.FontSize.Size18
  1444. TextButton30.TextColor3 = Color3.new(1, 0.2, 0)
  1445. TextButton30.TextTransparency = 1.8000003099442
  1446. Script31.Name = "Flash"
  1447. Script31.Parent = TextButton30
  1448. table.insert(cors,sandbox(Script31,function()
  1449. while true do wait()
  1450. for i=1,5 do
  1451. script.Parent.TextTransparency = script.Parent.TextTransparency + 0.1
  1452. wait(0.05)
  1453. end
  1454. wait(0.1)
  1455. for i=1,5 do
  1456. script.Parent.TextTransparency = script.Parent.TextTransparency - 0.1
  1457. wait(0.05)
  1458. end
  1459. end
  1460.  
  1461. end))
  1462. LocalScript32.Name = "MainScript"
  1463. LocalScript32.Parent = Tool0
  1464. table.insert(cors,sandbox(LocalScript32,function()
  1465. wait(1)
  1466. local Tool = script.Parent;
  1467. local pewsound
  1468. local bangsound
  1469. local cam
  1470. local ggui
  1471.  
  1472. enabled = true
  1473. automatichold = false
  1474. dmged = false
  1475. shotgun = false
  1476. equipped = false
  1477. overheated = false
  1478. isZoom = false
  1479.  
  1480. -----------------------------------------ONLY EDIT THESE VALUES!!!!!-----------------------------------------
  1481. -----!Instructions!-----
  1482. --Make sure you have a part in the gun named Barrel, it is where the raycast will shoot from.--
  1483. --Just place this script into any gun and edit the values below.--
  1484. --Editting anything else will risk breaking it.--
  1485. ------------------------
  1486. Damage = 20
  1487. SPS = 15 -- Shots Per Second, gives a limit of how fast the gun shoots.
  1488. Recoil = 3 -- [1-10] [1 = Minigun, 10 = Sniper]
  1489. WallShoot = false -- Shoots through walls.
  1490. GH = false -- [True = RB can't hurt RB.] [False = RB can hurt RB.]
  1491. BulletColor = "Cool yellow" -- Any Brickcolor will work.
  1492. Flash = true
  1493. --------------------------------------------------------------------------------------------------------
  1494.  
  1495. local zm = Instance.new("Part")
  1496. zm.Name = "ZoomZM"
  1497. zm.Anchored = true
  1498. zm.Transparency = 1
  1499. zm.Size = Vector3.new(1,1,1)
  1500. zm.CanCollide = false
  1501. GunType = 0
  1502.  
  1503. --[[local gui = Instance.new("ScreenGui")
  1504. local bg = Instance.new("Frame",gui)
  1505. local bar = Instance.new("Frame",bg)
  1506. local bvl = Instance.new("ImageLabel", bg)
  1507. bvl.Name = "Bevel"
  1508. bvl.BackgroundTransparency = 1
  1509. bvl.Image = "http://www.roblox.com/asset/?id=56852431"
  1510. bvl.Size = UDim2.new(1,0,1,0)
  1511. bg.Name = "Back"
  1512. bar.Name = "Charge"
  1513. bar.BackgroundColor3 = Color3.new(200/255,0/255,0/255)
  1514. bg.BackgroundColor3 = Color3.new(200/255,200/255,200/255)
  1515. bg.Size = UDim2.new(0,10,0,-100)
  1516. bg.Position = UDim2.new(0,5,0,500)
  1517. bar.Size = UDim2.new(0,4,-1,0)
  1518. bar.Position = UDim2.new(0,3,1,0)
  1519.  
  1520. ggui = gui:Clone()
  1521. ggui.Name = "GunGui"
  1522. ggui.Back.Charge.Size = UDim2.new(0,4,-(script.Charge.Value/100),0)]]
  1523.  
  1524. GroupID = 9999
  1525.  
  1526. function AntiGH(char1,char2)
  1527. if GH then
  1528. local plyr1 = game.Players:findFirstChild(char1.Name)
  1529. local plyr2 = game.Players:findFirstChild(char2.Name)
  1530. if plyr1 and plyr2 then
  1531. if plyr1:IsInGroup(GroupID) and plyr2:IsInGroup(GroupID) then
  1532. return false
  1533. end
  1534. end
  1535. return true
  1536. elseif not GH then
  1537. return true
  1538. end
  1539. end
  1540.  
  1541. MaxDist = 1000
  1542.  
  1543. function RayCast(Start,End,Ignore)
  1544. if WallShoot then
  1545. ray1 = Ray.new(Start, End.unit * 999.999)
  1546. local Part1, TempPos = Workspace:FindPartOnRay(ray1,Ignore)
  1547. ray2 = Ray.new(TempPos, End.unit * 999.999)
  1548. local Part2, EndPos = Workspace:FindPartOnRay(ray2,Part1)
  1549. return Part1, Part2, EndPos
  1550. elseif not WallShoot then
  1551. ray = Ray.new(Start, End.unit * 999.999)
  1552. return Workspace:FindPartOnRay(ray,Ignore)
  1553. end
  1554. end
  1555.  
  1556. function DmgPlr(Part)
  1557. if Part ~= nil then
  1558. local c = Instance.new("ObjectValue")
  1559. c.Name = "creator"
  1560. c.Value = game.Players:findFirstChild(script.Parent.Parent.Name)
  1561. local hum = Part.Parent:findFirstChild("Humanoid")
  1562. local hathum = Part.Parent.Parent:findFirstChild("Humanoid")
  1563. local hat = Part.Parent
  1564. if hathum ~= nil and hat:IsA("Hat") and AntiGH(hathum.Parent, script.Parent.Parent) then
  1565. hathum:TakeDamage(Damage/1)
  1566. Part.Parent = game.Workspace
  1567. Part.CFrame = CFrame.new(Part.Position + Vector3.new(math.random(-5,5),math.random(-5,5),math.random(-5,5)))
  1568. hat:Remove()
  1569. c.Parent = hathum
  1570. game.Debris:AddItem(c,1.5)
  1571. elseif hum ~= nil and AntiGH(hum.Parent, script.Parent.Parent) then
  1572. if Part.Name == "Head" then
  1573. hum:TakeDamage(Damage*1.3)
  1574. end
  1575. hum:TakeDamage(Damage)
  1576. c.Parent = hum
  1577. game.Debris:AddItem(c,1.5)
  1578. end
  1579. end
  1580. end
  1581.  
  1582. function onButton1Down(mouse)
  1583. if script.Parent.Ammo.Value == 0 then
  1584. else
  1585. if GunType == 0 then
  1586. if (not enabled) then return end
  1587. enabled = false
  1588. LaserShoot(mouse)
  1589. if Flash then
  1590. script.Parent.Barrel.Light.Light.Visible = true
  1591. end
  1592. script.Parent.Ammo.Value = script.Parent.Ammo.Value - 1
  1593. wait(0.01)
  1594. if Flash then
  1595. script.Parent.Barrel.Light.Light.Visible = false
  1596. end
  1597. wait(1/SPS)
  1598. enabled = true
  1599. elseif GunType == 1 then
  1600. automatichold = true
  1601. while automatichold == true and script.Parent.Ammo.Value ~= 0 do wait()
  1602. if (not enabled) then return end
  1603. if script.Parent.Parent:findFirstChild("Humanoid").Health == 0 then script.Parent:Remove() end
  1604. enabled = false
  1605. LaserShoot(mouse)
  1606. if Flash then
  1607. script.Parent.Barrel.Light.Light.Visible = true
  1608. end
  1609. script.Parent.Ammo.Value = script.Parent.Ammo.Value - 1
  1610. wait(0.01)
  1611. if Flash then
  1612. script.Parent.Barrel.Light.Light.Visible = false
  1613. end
  1614. wait(1/SPS)
  1615. enabled = true
  1616. end
  1617. end
  1618. end
  1619. end
  1620.  
  1621. function LaserShoot(mouse)
  1622. hit = mouse.Hit.p
  1623. local StartPos = script.Parent.Barrel.CFrame.p
  1624. local rv = (StartPos-hit).magnitude/(Recoil * 20)
  1625. local rcl = Vector3.new(math.random(-rv,rv),math.random(-rv,rv),math.random(-rv,rv))
  1626. aim = hit + rcl
  1627. local P = Instance.new("Part")
  1628. P.Name = "Bullet"
  1629. P.formFactor = 3
  1630. P.BrickColor = BrickColor.new(BulletColor)
  1631. P.Size = Vector3.new(1,1,1)
  1632. P.Anchored = true
  1633. P.CanCollide = false
  1634. P.Transparency = 0.5
  1635. P.Parent = script.Parent.Parent
  1636. local m = Instance.new("CylinderMesh")
  1637. m.Name = "Mesh"
  1638. m.Parent = P
  1639. local c = Instance.new("ObjectValue")
  1640. c.Name = "creator"
  1641. c.Value = game.Players:findFirstChild(script.Parent.Parent.Name)
  1642. pewsound = script:FindFirstChild("Fire")
  1643. if pewsound then
  1644. pewsound:Play()
  1645. end --Brick created. Moving on to next part
  1646. local SPos = script.Parent.Barrel.CFrame.p
  1647. if WallShoot then
  1648. local Part1, Part2, EndPos = RayCast(SPos, (aim-SPos).unit * 999, script.Parent.Parent)
  1649. DmgPlr(Part1)
  1650. DmgPlr(Part2)
  1651. if Part1 and Part2 then
  1652. local enddist = (EndPos-SPos).magnitude
  1653. P.CFrame = CFrame.new(EndPos, SPos) * CFrame.new(0,0,-enddist/2) * CFrame.Angles(math.rad(90),0,0)
  1654. m.Scale = Vector3.new(.04,enddist,.04)
  1655. else
  1656. P.CFrame = CFrame.new(EndPos, SPos) * CFrame.new(0,0,-MaxDist/2) * CFrame.Angles(math.rad(90),0,0)
  1657. m.Scale = Vector3.new(.04,MaxDist,.04)
  1658. end
  1659. elseif not WallShoot then
  1660. local Part, Pos = RayCast(SPos, (aim-SPos).unit * 999, script.Parent.Parent)
  1661. DmgPlr(Part)
  1662. if Part then
  1663. local dist = (Pos-SPos).magnitude
  1664. P.CFrame = CFrame.new(Pos, SPos) * CFrame.new(0,0,-dist/2) * CFrame.Angles(math.rad(90),0,0)
  1665. m.Scale = Vector3.new(.1,dist,.1)
  1666. else
  1667. P.CFrame = CFrame.new(Pos, SPos) * CFrame.new(0,0,-MaxDist/2) * CFrame.Angles(math.rad(90),0,0)
  1668. m.Scale = Vector3.new(.1,MaxDist,.1)
  1669. end
  1670. end
  1671. game.Debris:AddItem(P,.1)
  1672. end
  1673.  
  1674. function onButton1Up(mouse)
  1675. automatichold = false
  1676. end
  1677.  
  1678. function onKeyDown(key, mouse)
  1679.  
  1680.  
  1681.  
  1682. if key:lower() == "r" then
  1683. if script.Parent.Ammo.Value ~= script.Parent.MaxAmmo.Value then
  1684. reloadsound = script:FindFirstChild("Reload")
  1685. if reloadsound then
  1686. reloadsound:Play()
  1687. end
  1688. enabled = false
  1689. script.Parent.VisibleB.Value = true
  1690. script.Parent.StringValue.Value = "Reloading"
  1691. repeat script.Parent.StringValue.Value = "Reloading" wait(0.3) script.Parent.Ammo.Value = script.Parent.Ammo.Value + 3 script.Parent.StringValue.Value = "Reloading" until script.Parent.Ammo.Value >= script.Parent.MaxAmmo.Value
  1692. script.Parent.Ammo.Value = script.Parent.MaxAmmo.Value
  1693. wait(0.2)
  1694. script.Parent.VisibleB.Value = false
  1695. enabled = true
  1696. end
  1697. end
  1698.  
  1699. if key:lower() == "m" then
  1700. if GunType == 0 then
  1701. GunType = 0
  1702. Recoil = 3
  1703. else
  1704. GunType = 1
  1705. Recoil = 3
  1706. end
  1707. end
  1708.  
  1709. end
  1710.  
  1711. function onEquipped(mouse)
  1712. equipped = true
  1713.  
  1714. if mouse == nil then
  1715. print("Mouse not found")
  1716. return
  1717. end
  1718. mouse.Icon = "http://www.roblox.com/asset/?id=52812029"
  1719. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  1720. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  1721. mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  1722.  
  1723. end
  1724.  
  1725. function onUnequipped(mouse)
  1726. equipped = false
  1727. automatichold = false
  1728.  
  1729.  
  1730. end
  1731.  
  1732. script.Parent.Equipped:connect(onEquipped)
  1733. script.Parent.Unequipped:connect(onUnequipped)
  1734. while true do wait()
  1735. if script.Parent.Ammo.Value == 0 then
  1736. script.Parent.VisibleB.Value = true
  1737. script.Parent.StringValue.Value = "Reload"
  1738. end
  1739. if GunType == 1 then
  1740. script.Parent.ModeText.Value = "Auto"
  1741. else
  1742. script.Parent.ModeText.Value = "Semi"
  1743. end
  1744. end
  1745.  
  1746.  
  1747. end))
  1748. Sound33.Name = "Fire"
  1749. Sound33.Parent = LocalScript32
  1750. Sound33.SoundId = "http://roblox.com/asset/?id=519174837"
  1751. Sound33.Volume = 1
  1752. Sound34.Name = "Reload"
  1753. Sound34.Parent = LocalScript32
  1754. Sound34.SoundId = "http://www.roblox.com/asset/?id=519174837"
  1755. Sound34.Volume = 1
  1756. Sound34.PlayOnRemove = true
  1757. StringValue35.Name = "ModeText"
  1758. StringValue35.Parent = Tool0
  1759. StringValue35.Value = "Nil"
  1760. for i,v in pairs(mas:GetChildren()) do
  1761. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  1762. pcall(function() v:MakeJoints() end)
  1763. end
  1764. mas:Destroy()
  1765. for i,v in pairs(cors) do
  1766. spawn(function()
  1767. pcall(v)
  1768. end)
  1769. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement