Advertisement
Roblox_Xploits

fger

Nov 5th, 2017
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.66 KB | None | 0 0
  1.  
  2. --Converted with ttyyuu12345's model to script plugin v4
  3. function sandbox(var,func)
  4. local env = getfenv(func)
  5. local newenv = setmetatable({},{
  6. __index = function(self,k)
  7. if k=="script" then
  8. return var
  9. else
  10. return env[k]
  11. end
  12. end,
  13. })
  14. setfenv(func,newenv)
  15. return func
  16. end
  17. cors = {}
  18. mas = Instance.new("Model",game:GetService("Lighting"))
  19. Tool0 = Instance.new("Tool")
  20. ScreenGui1 = Instance.new("ScreenGui")
  21. Frame2 = Instance.new("Frame")
  22. TextLabel3 = Instance.new("TextLabel")
  23. TextLabel4 = Instance.new("TextLabel")
  24. TextLabel5 = Instance.new("TextLabel")
  25. Frame6 = Instance.new("Frame")
  26. Frame7 = Instance.new("Frame")
  27. Frame8 = Instance.new("Frame")
  28. Frame9 = Instance.new("Frame")
  29. Frame10 = Instance.new("Frame")
  30. ImageLabel11 = Instance.new("ImageLabel")
  31. TextLabel12 = Instance.new("TextLabel")
  32. Part13 = Instance.new("Part")
  33. Sound14 = Instance.new("Sound")
  34. SpecialMesh15 = Instance.new("SpecialMesh")
  35. Fire16 = Instance.new("Fire")
  36. Animation17 = Instance.new("Animation")
  37. LocalScript18 = Instance.new("LocalScript")
  38. Tool0.Name = "AssaultRifle"
  39. Tool0.Parent = mas
  40. Tool0.TextureId = "http://www.roblox.com/asset/?id=72012711"
  41. Tool0.GripForward = Vector3.new(-0, 1, -0)
  42. Tool0.GripPos = Vector3.new(0, -0.649999976, -0.300000012)
  43. Tool0.GripUp = Vector3.new(-0, 0, 1)
  44. Tool0.CanBeDropped = false
  45. ScreenGui1.Name = "WeaponHud"
  46. ScreenGui1.Parent = Tool0
  47. Frame2.Name = "AmmoHud"
  48. Frame2.Parent = ScreenGui1
  49. Frame2.Transparency = 1
  50. Frame2.Size = UDim2.new(0, 200, 0, 50)
  51. Frame2.Position = UDim2.new(1, -265, 1, -60)
  52. Frame2.BackgroundTransparency = 1
  53. Frame2.BorderSizePixel = 0
  54. TextLabel3.Name = "ForwardSlash"
  55. TextLabel3.Parent = Frame2
  56. TextLabel3.Transparency = 1
  57. TextLabel3.Text = "/"
  58. TextLabel3.Position = UDim2.new(0.5, 0, 0.5, 0)
  59. TextLabel3.BackgroundTransparency = 1
  60. TextLabel3.BorderSizePixel = 0
  61. TextLabel3.FontSize = Enum.FontSize.Size18
  62. TextLabel3.TextColor3 = Color3.new(0, 0, 0)
  63. TextLabel3.TextStrokeColor3 = Color3.new(0, 1, 0)
  64. TextLabel3.TextStrokeTransparency = 0
  65. TextLabel4.Name = "ClipAmmo"
  66. TextLabel4.Parent = Frame2
  67. TextLabel4.Transparency = 1
  68. TextLabel4.Text = "54"
  69. TextLabel4.Position = UDim2.new(0.449999988, 0, 0.5, 0)
  70. TextLabel4.BackgroundTransparency = 1
  71. TextLabel4.BorderSizePixel = 0
  72. TextLabel4.FontSize = Enum.FontSize.Size18
  73. TextLabel4.TextColor3 = Color3.new(0, 0, 0)
  74. TextLabel4.TextStrokeColor3 = Color3.new(0, 1, 0)
  75. TextLabel4.TextStrokeTransparency = 0
  76. TextLabel4.TextXAlignment = Enum.TextXAlignment.Right
  77. TextLabel5.Name = "TotalAmmo"
  78. TextLabel5.Parent = Frame2
  79. TextLabel5.Transparency = 1
  80. TextLabel5.Text = "180"
  81. TextLabel5.Position = UDim2.new(0.550000012, 0, 0.5, 0)
  82. TextLabel5.BackgroundTransparency = 1
  83. TextLabel5.BorderSizePixel = 0
  84. TextLabel5.FontSize = Enum.FontSize.Size18
  85. TextLabel5.TextColor3 = Color3.new(0, 0, 0)
  86. TextLabel5.TextStrokeColor3 = Color3.new(0, 1, 0)
  87. TextLabel5.TextStrokeTransparency = 0
  88. TextLabel5.TextXAlignment = Enum.TextXAlignment.Left
  89. Frame6.Name = "Crosshair"
  90. Frame6.Parent = ScreenGui1
  91. Frame6.Transparency = 1
  92. Frame6.Size = UDim2.new(0, 150, 0, 150)
  93. Frame6.Position = UDim2.new(0, 500, 0, 500)
  94. Frame6.BackgroundColor3 = Color3.new(0, 1, 0)
  95. Frame6.BackgroundTransparency = 1
  96. Frame6.BorderSizePixel = 0
  97. Frame7.Name = "TopFrame"
  98. Frame7.Parent = Frame6
  99. Frame7.Size = UDim2.new(0, 2, 0, 14)
  100. Frame7.Position = UDim2.new(0, -1, -0.5, -7)
  101. Frame7.BackgroundColor3 = Color3.new(0, 0, 0)
  102. Frame7.BorderColor3 = Color3.new(0, 1, 0)
  103. Frame8.Name = "BottomFrame"
  104. Frame8.Parent = Frame6
  105. Frame8.Size = UDim2.new(0, 2, 0, 14)
  106. Frame8.Position = UDim2.new(0, -1, 0.5, -7)
  107. Frame8.BackgroundColor3 = Color3.new(0, 0, 0)
  108. Frame8.BorderColor3 = Color3.new(0, 1, 0)
  109. Frame9.Name = "RightFrame"
  110. Frame9.Parent = Frame6
  111. Frame9.Size = UDim2.new(0, 14, 0, 2)
  112. Frame9.Position = UDim2.new(0.5, -7, 0, -1)
  113. Frame9.BackgroundColor3 = Color3.new(0, 0, 0)
  114. Frame9.BorderColor3 = Color3.new(0, 1, 0)
  115. Frame10.Name = "LeftFrame"
  116. Frame10.Parent = Frame6
  117. Frame10.Size = UDim2.new(0, 14, 0, 2)
  118. Frame10.Position = UDim2.new(-0.5, -7, 0, -1)
  119. Frame10.BackgroundColor3 = Color3.new(0, 0, 0)
  120. Frame10.BorderColor3 = Color3.new(0, 1, 0)
  121. ImageLabel11.Name = "TargetHitImage"
  122. ImageLabel11.Parent = Frame6
  123. ImageLabel11.Transparency = 1
  124. ImageLabel11.Size = UDim2.new(0, 50, 0, 50)
  125. ImageLabel11.Position = UDim2.new(0, -25, 0, -25)
  126. ImageLabel11.Visible = false
  127. ImageLabel11.BackgroundTransparency = 1
  128. ImageLabel11.BorderSizePixel = 0
  129. ImageLabel11.Image = "http://www.roblox.com/asset/?id=69368028"
  130. TextLabel12.Name = "ReloadingLabel"
  131. TextLabel12.Parent = Frame6
  132. TextLabel12.Transparency = 1
  133. TextLabel12.Text = "Reloading"
  134. TextLabel12.Position = UDim2.new(0, 20, 0, -20)
  135. TextLabel12.Visible = false
  136. TextLabel12.BackgroundTransparency = 1
  137. TextLabel12.BorderSizePixel = 0
  138. TextLabel12.Font = Enum.Font.ArialBold
  139. TextLabel12.FontSize = Enum.FontSize.Size18
  140. TextLabel12.TextColor3 = Color3.new(0, 0, 0)
  141. TextLabel12.TextStrokeColor3 = Color3.new(0, 1, 0)
  142. TextLabel12.TextStrokeTransparency = 0
  143. TextLabel12.TextXAlignment = Enum.TextXAlignment.Left
  144. TextLabel12.TextYAlignment = Enum.TextYAlignment.Bottom
  145. Part13.Name = "Handle"
  146. Part13.Parent = Tool0
  147. Part13.BrickColor = BrickColor.new("Black")
  148. Part13.Rotation = Vector3.new(-90, 0, -90)
  149. Part13.FormFactor = Enum.FormFactor.Custom
  150. Part13.Size = Vector3.new(0.400000006, 3.4000001, 0.800000012)
  151. Part13.CFrame = CFrame.new(-0.300000012, 0.400000006, -0.200000003, 0, 1, 0, 0, 0, 1, 1, 0, 0)
  152. Part13.Color = Color3.new(0.105882, 0.164706, 0.207843)
  153. Part13.Position = Vector3.new(-0.300000012, 0.400000006, -0.200000003)
  154. Part13.Orientation = Vector3.new(-90, -90, 0)
  155. Part13.Color = Color3.new(0.105882, 0.164706, 0.207843)
  156. Sound14.Name = "FireSound"
  157. Sound14.Parent = Part13
  158. Sound14.Pitch = 0.69999998807907
  159. Sound14.SoundId = "http://www.roblox.com/asset/?id=27127089"
  160. Sound14.Volume = 1
  161. SpecialMesh15.Parent = Part13
  162. SpecialMesh15.MeshId = "http://www.roblox.com/asset/?id=72012671"
  163. SpecialMesh15.TextureId = "http://www.roblox.com/asset/?id=72012605"
  164. SpecialMesh15.VertexColor = Vector3.new(2, 2, 2)
  165. SpecialMesh15.MeshType = Enum.MeshType.FileMesh
  166. Fire16.Parent = Part13
  167. Fire16.Size = 2
  168. Fire16.Color = Color3.new(0.145098, 0.145098, 0.164706)
  169. Fire16.Enabled = false
  170. Fire16.Heat = 0
  171. Fire16.SecondaryColor = Color3.new(0, 0, 0)
  172. Fire16.Color = Color3.new(0.145098, 0.145098, 0.164706)
  173. Animation17.Name = "Recoil"
  174. Animation17.Parent = Tool0
  175. Animation17.AnimationId = "http://www.roblox.com/Asset?ID=89289443"
  176. LocalScript18.Name = "AssaultRifleScript"
  177. LocalScript18.Parent = Tool0
  178. table.insert(cors,sandbox(LocalScript18,function()
  179. --------------------- TEMPLATE ASSAULT RIFLE WEAPON ---------------------------
  180. -- Waits for the child of the specified parent
  181. local function WaitForChild(parent, childName)
  182. while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
  183. return parent[childName]
  184. end
  185.  
  186. ----- MAGIC NUMBERS ABOUT THE TOOL -----
  187. -- How much damage a bullet does
  188. local Damage = 10
  189. -- How many times per second the gun can fire
  190. local FireRate = 5 / 30
  191. -- The maximum distance the can can shoot, this value should never go above 1000
  192. local Range = 400
  193. -- In radians the minimum accuracy penalty
  194. local MinSpread = 0.01
  195. -- In radian the maximum accuracy penalty
  196. local MaxSpread = 0.1
  197. -- Number of bullets in a clip
  198. local ClipSize = 30
  199. -- DefaultValue for spare ammo
  200. local SpareAmmo = 600
  201. -- The amount the aim will increase or decrease by
  202. -- decreases this number reduces the speed that recoil takes effect
  203. local AimInaccuracyStepAmount = 0.0125
  204. -- Time it takes to reload weapon
  205. local ReloadTime = 3
  206. ----------------------------------------
  207.  
  208. -- Colors
  209. local FriendlyReticleColor = Color3.new(0, 1, 0)
  210. local EnemyReticleColor = Color3.new(1, 0, 0)
  211. local NeutralReticleColor = Color3.new(1, 1, 1)
  212.  
  213. local Spread = MinSpread
  214. local AmmoInClip = ClipSize
  215.  
  216. local Tool = script.Parent
  217. local Handle = WaitForChild(Tool, 'Handle')
  218. local WeaponGui = nil
  219.  
  220. local LeftButtonDown
  221. local Reloading = false
  222. local IsShooting = false
  223.  
  224. -- Player specific convenience variables
  225. local MyPlayer = nil
  226. local MyCharacter = nil
  227. local MyHumanoid = nil
  228. local MyTorso = nil
  229. local MyMouse = nil
  230.  
  231. local RecoilAnim
  232. local RecoilTrack = nil
  233.  
  234. local IconURL = Tool.TextureId -- URL to the weapon icon asset
  235.  
  236. local DebrisService = game:GetService('Debris')
  237. local PlayersService = game:GetService('Players')
  238.  
  239.  
  240. local FireSound
  241.  
  242. local OnFireConnection = nil
  243. local OnReloadConnection = nil
  244.  
  245. local DecreasedAimLastShot = false
  246. local LastSpreadUpdate = time()
  247.  
  248. -- this is a dummy object that holds the flash made when the gun is fired
  249. local FlashHolder = nil
  250.  
  251.  
  252. local WorldToCellFunction = Workspace.Terrain.WorldToCellPreferSolid
  253. local GetCellFunction = Workspace.Terrain.GetCell
  254.  
  255. function RayIgnoreCheck(hit, pos)
  256. if hit then
  257. if hit.Transparency >= 1 or string.lower(hit.Name) == "water" or
  258. hit.Name == "Effect" or hit.Name == "Rocket" or hit.Name == "Bullet" or
  259. hit.Name == "Handle" or hit:IsDescendantOf(MyCharacter) then
  260. return true
  261. elseif hit:IsA('Terrain') and pos then
  262. local cellPos = WorldToCellFunction(Workspace.Terrain, pos)
  263. if cellPos then
  264. local cellMat = GetCellFunction(Workspace.Terrain, cellPos.x, cellPos.y, cellPos.z)
  265. if cellMat and cellMat == Enum.CellMaterial.Water then
  266. return true
  267. end
  268. end
  269. end
  270. end
  271. return false
  272. end
  273.  
  274. -- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000
  275. function RayCast(startPos, vec, rayLength)
  276. local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle)
  277. if hitObject and hitPos then
  278. local distance = rayLength - (hitPos - startPos).magnitude
  279. if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then
  280. -- there is a chance here for potential infinite recursion
  281. return RayCast(hitPos, vec, distance)
  282. end
  283. end
  284. return hitObject, hitPos
  285. end
  286.  
  287.  
  288.  
  289. function TagHumanoid(humanoid, player)
  290. -- Add more tags here to customize what tags are available.
  291. while humanoid:FindFirstChild('creator') do
  292. humanoid:FindFirstChild('creator'):Destroy()
  293. end
  294. local creatorTag = Instance.new("ObjectValue")
  295. creatorTag.Value = player
  296. creatorTag.Name = "creator"
  297. creatorTag.Parent = humanoid
  298. DebrisService:AddItem(creatorTag, 1.5)
  299.  
  300. local weaponIconTag = Instance.new("StringValue")
  301. weaponIconTag.Value = IconURL
  302. weaponIconTag.Name = "icon"
  303. weaponIconTag.Parent = creatorTag
  304. end
  305.  
  306. local function CreateFlash()
  307. if FlashHolder then
  308. local flash = Instance.new('Fire', FlashHolder)
  309. flash.Color = Color3.new(1, 140 / 255, 0)
  310. flash.SecondaryColor = Color3.new(1, 0, 0)
  311. flash.Size = 0.3
  312. DebrisService:AddItem(flash, FireRate / 1.5)
  313. else
  314. FlashHolder = Instance.new("Part", Tool)
  315. FlashHolder.Transparency = 1
  316. FlashHolder.CanCollide= false
  317. FlashHolder.Size = Vector3.new(1, 1, 1)
  318. FlashHolder.Position = Tool.Handle.Position
  319. local Weld = Instance.new("ManualWeld")
  320. Weld.C0 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  321. Weld.C1 = CFrame.new(0, 2.2, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0)
  322. Weld.Part0 = FlashHolder
  323. Weld.Part1 = Tool.Handle
  324. Weld.Parent = FlashHolder
  325. end
  326. end
  327.  
  328. local function CreateBullet(bulletPos)
  329. local bullet = Instance.new('Part', Workspace)
  330. bullet.FormFactor = Enum.FormFactor.Custom
  331. bullet.Size = Vector3.new(0.1, 0.1, 0.1)
  332. bullet.BrickColor = MyPlayer.TeamColor
  333. bullet.Shape = Enum.PartType.Ball
  334. bullet.CanCollide = false
  335. bullet.CFrame = CFrame.new(bulletPos)
  336. bullet.Anchored = true
  337. bullet.TopSurface = Enum.SurfaceType.Smooth
  338. bullet.BottomSurface = Enum.SurfaceType.Smooth
  339. bullet.Name = 'Bullet'
  340. DebrisService:AddItem(bullet, 2.5)
  341. local fire = Instance.new("Fire", bullet)
  342. fire.Color = Color3.new(MyPlayer.TeamColor.r, MyPlayer.TeamColor.g, MyPlayer.TeamColor.b)
  343. fire.SecondaryColor = Color3.new(MyPlayer.TeamColor.r, MyPlayer.TeamColor.g, MyPlayer.TeamColor.b)
  344. fire.Size = 5
  345. fire.Heat = 0
  346. DebrisService:AddItem(fire, 0.2)
  347. return bullet
  348. end
  349.  
  350. local function Reload()
  351. if not Reloading then
  352. Reloading = true
  353. -- Don't reload if you are already full or have no extra ammo
  354. if AmmoInClip ~= ClipSize and SpareAmmo > 0 then
  355. if RecoilTrack then
  356. RecoilTrack:Stop()
  357. end
  358. if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
  359. if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
  360. WeaponGui.Crosshair.ReloadingLabel.Visible = true
  361. end
  362. end
  363. wait(ReloadTime)
  364. -- Only use as much ammo as you have
  365. local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo)
  366. AmmoInClip = AmmoInClip + ammoToUse
  367. SpareAmmo = SpareAmmo - ammoToUse
  368. UpdateAmmo(AmmoInClip)
  369. end
  370. Reloading = false
  371. end
  372. end
  373.  
  374. function OnFire()
  375. if IsShooting then return end
  376. if MyHumanoid and MyHumanoid.Health > 0 then
  377. if RecoilTrack and AmmoInClip > 0 then
  378. RecoilTrack:Play()
  379. end
  380. IsShooting = true
  381. while LeftButtonDown and AmmoInClip > 0 and not Reloading do
  382. if Spread and not DecreasedAimLastShot then
  383. Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount)
  384. UpdateCrosshair(Spread)
  385. end
  386. DecreasedAimLastShot = not DecreasedAimLastShot
  387. if Handle:FindFirstChild('FireSound') then
  388. Handle.FireSound:Play()
  389. end
  390. CreateFlash()
  391. if MyMouse then
  392. local targetPoint = MyMouse.Hit.p
  393. local shootDirection = (targetPoint - Handle.Position).unit
  394. -- Adjust the shoot direction randomly off by a little bit to account for recoil
  395. shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
  396. (0.5 - math.random()) * 2 * Spread,
  397. (0.5 - math.random()) * 2 * Spread) * shootDirection
  398. local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
  399. local bullet
  400. -- Create a bullet here
  401. if hitObject then
  402. bullet = CreateBullet(bulletPos)
  403. end
  404. if hitObject and hitObject.Parent then
  405. local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
  406. if hitHumanoid then
  407. local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
  408. if MyPlayer.Neutral or (hitPlayer and hitPlayer.TeamColor ~= MyPlayer.TeamColor) then
  409. TagHumanoid(hitHumanoid, MyPlayer)
  410. hitHumanoid:TakeDamage(Damage)
  411. if bullet then
  412. bullet:Destroy()
  413. bullet = nil
  414. --bullet.Transparency = 1
  415. end
  416. Spawn(UpdateTargetHit)
  417. end
  418. end
  419. end
  420.  
  421. AmmoInClip = AmmoInClip - 1
  422. UpdateAmmo(AmmoInClip)
  423. end
  424. wait(FireRate)
  425. end
  426. IsShooting = false
  427. if AmmoInClip == 0 then
  428. Reload()
  429. end
  430. if RecoilTrack then
  431. RecoilTrack:Stop()
  432. end
  433. end
  434. end
  435.  
  436. local TargetHits = 0
  437. function UpdateTargetHit()
  438. TargetHits = TargetHits + 1
  439. if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
  440. WeaponGui.Crosshair.TargetHitImage.Visible = true
  441. end
  442. wait(0.5)
  443. TargetHits = TargetHits - 1
  444. if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
  445. WeaponGui.Crosshair.TargetHitImage.Visible = false
  446. end
  447. end
  448.  
  449. function UpdateCrosshair(value, mouse)
  450. if WeaponGui then
  451. local absoluteY = 650
  452. WeaponGui.Crosshair:TweenSize(
  453. UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23),
  454. Enum.EasingDirection.Out,
  455. Enum.EasingStyle.Linear,
  456. 0.33)
  457. end
  458. end
  459.  
  460. function UpdateAmmo(value)
  461. if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
  462. WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip
  463. if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
  464. WeaponGui.Crosshair.ReloadingLabel.Visible = false
  465. end
  466. end
  467. if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
  468. WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo
  469. end
  470. end
  471.  
  472.  
  473. function OnMouseDown()
  474. LeftButtonDown = true
  475. OnFire()
  476. end
  477.  
  478. function OnMouseUp()
  479. LeftButtonDown = false
  480. end
  481.  
  482. function OnKeyDown(key)
  483. if string.lower(key) == 'r' then
  484. Reload()
  485. end
  486. end
  487.  
  488.  
  489. function OnEquipped(mouse)
  490. RecoilAnim = WaitForChild(Tool, 'Recoil')
  491. FireSound = WaitForChild(Handle, 'FireSound')
  492.  
  493. MyCharacter = Tool.Parent
  494. MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
  495. MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
  496. MyTorso = MyCharacter:FindFirstChild('Torso')
  497. MyMouse = mouse
  498. WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone()
  499. if WeaponGui and MyPlayer then
  500. WeaponGui.Parent = MyPlayer.PlayerGui
  501. UpdateAmmo(AmmoInClip)
  502. end
  503. if RecoilAnim then
  504. RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim)
  505. end
  506.  
  507. if MyMouse then
  508. -- Disable mouse icon
  509. MyMouse.Icon = "http://www.roblox.com/asset/?id=18662154"
  510. MyMouse.Button1Down:connect(OnMouseDown)
  511. MyMouse.Button1Up:connect(OnMouseUp)
  512. MyMouse.KeyDown:connect(OnKeyDown)
  513. end
  514. end
  515.  
  516.  
  517. -- Unequip logic here
  518. function OnUnequipped()
  519. LeftButtonDown = false
  520. Reloading = false
  521. MyCharacter = nil
  522. MyHumanoid = nil
  523. MyTorso = nil
  524. MyPlayer = nil
  525. MyMouse = nil
  526. if OnFireConnection then
  527. OnFireConnection:disconnect()
  528. end
  529. if OnReloadConnection then
  530. OnReloadConnection:disconnect()
  531. end
  532. if FlashHolder then
  533. FlashHolder = nil
  534. end
  535. if WeaponGui then
  536. WeaponGui.Parent = nil
  537. WeaponGui = nil
  538. end
  539. if RecoilTrack then
  540. RecoilTrack:Stop()
  541. end
  542. end
  543.  
  544. local function SetReticleColor(color)
  545. if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
  546. for _, line in pairs(WeaponGui.Crosshair:GetChildren()) do
  547. if line:IsA('Frame') then
  548. line.BorderColor3 = color
  549. end
  550. end
  551. end
  552. end
  553.  
  554.  
  555. Tool.Equipped:connect(OnEquipped)
  556. Tool.Unequipped:connect(OnUnequipped)
  557.  
  558. while true do
  559. wait(0.033)
  560. if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and MyMouse then
  561. WeaponGui.Crosshair.Position = UDim2.new(0, MyMouse.X, 0, MyMouse.Y)
  562. SetReticleColor(NeutralReticleColor)
  563.  
  564. local target = MyMouse.Target
  565. if target and target.Parent then
  566. local player = PlayersService:GetPlayerFromCharacter(target.Parent)
  567. if player then
  568. if MyPlayer.Neutral or player.TeamColor ~= MyPlayer.TeamColor then
  569. SetReticleColor(EnemyReticleColor)
  570. else
  571. SetReticleColor(FriendlyReticleColor)
  572. end
  573. end
  574. end
  575. end
  576. if Spread and not IsShooting then
  577. local currTime = time()
  578. if currTime - LastSpreadUpdate > FireRate * 2 then
  579. LastSpreadUpdate = currTime
  580. Spread = math.max(MinSpread, Spread - AimInaccuracyStepAmount)
  581. UpdateCrosshair(Spread, MyMouse)
  582. end
  583. end
  584. end
  585.  
  586. end))
  587. for i,v in pairs(mas:GetChildren()) do
  588. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  589. pcall(function() v:MakeJoints() end)
  590. end
  591. mas:Destroy()
  592. for i,v in pairs(cors) do
  593. spawn(function()
  594. pcall(v)
  595. end)
  596. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement