Advertisement
wamandnj

Untitled

Oct 17th, 2018
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Character = game.Players.LocalPlayer.Character
  2. Player = owner
  3. char = Character
  4. hum = Character.Humanoid
  5. Torso = Character.Torso
  6. Head = Character.Head
  7.  
  8. -- This script has been converted to FE by iPxter
  9.  
  10.  
  11. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  12. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  13. do
  14. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  15. script.Parent = Player.Character
  16.  
  17. --RemoteEvent for communicating
  18. local Event = Instance.new("RemoteEvent")
  19. Event.Name = "UserInput_Event"
  20.  
  21. --Fake event to make stuff like Mouse.KeyDown work
  22. local function fakeEvent()
  23. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  24. t.connect = t.Connect
  25. return t
  26. end
  27.  
  28. --Creating fake input objects with fake variables
  29. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  30. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  31. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  32. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  33. end}
  34. --Merged 2 functions into one by checking amount of arguments
  35. CAS.UnbindAction = CAS.BindAction
  36.  
  37. --This function will trigger the events that have been :Connect()'ed
  38. local function te(self,ev,...)
  39. local t = m[ev]
  40. if t and t._fakeEvent and t.Function then
  41. t.Function(...)
  42. end
  43. end
  44. m.TrigEvent = te
  45. UIS.TrigEvent = te
  46.  
  47. Event.OnServerEvent:Connect(function(plr,io)
  48. if plr~=Player then return end
  49. if io.isMouse then
  50. m.Target = io.Target
  51. m.Hit = io.Hit
  52. else
  53. local b = io.UserInputState == Enum.UserInputState.Begin
  54. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  55. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  56. end
  57. for _,t in pairs(CAS.Actions) do
  58. for _,k in pairs(t.Keys) do
  59. if k==io.KeyCode then
  60. t.Function(t.Name,io.UserInputState,io)
  61. end
  62. end
  63. end
  64. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  65. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  66. end
  67.  
  68. end)
  69. Event.Parent = NLS([==[
  70. local Player = owner
  71. local Event = script:WaitForChild("UserInput_Event")
  72.  
  73. local UIS = game:GetService("UserInputService")
  74. local input = function(io,a)
  75. if a then return end
  76. --Since InputObject is a client-side instance, we create and pass table instead
  77. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  78. end
  79. UIS.InputBegan:Connect(input)
  80. UIS.InputEnded:Connect(input)
  81.  
  82. local h,t
  83. --Give the server mouse data 30 times every second, but only if the values changed
  84. --If player is not moving their mouse, client won't fire events
  85. while wait(1/30) do
  86. if h~=Mouse.Hit or t~=Mouse.Target then
  87. h,t=Mouse.Hit,Mouse.Target
  88. Event:FireServer({isMouse=true,Target=t,Hit=h})
  89. end
  90. end]==],Player.Character)
  91. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  92. end
  93.  
  94. char.Shirt.ShirtTemplate = "rbxassetid://994469018"
  95. char.Pants.PantsTemplate = "rbxassetid://977437883"
  96.  
  97.  
  98. local BC = char["Body Colors"]
  99. BC.HeadColor = BrickColor.new("Really black")
  100. BC.LeftArmColor = BrickColor.new("Really black")
  101. BC.LeftLegColor = BrickColor.new("Really black")
  102. BC.RightArmColor = BrickColor.new("Really black")
  103. BC.RightLegColor = BrickColor.new("Really black")
  104. BC.TorsoColor = BrickColor.new("Really black")
  105.  
  106. char.Head.face.Texture = "rbxassetid://701379058"
  107.  
  108. hum.MaxHealth = math.huge
  109.  
  110.  
  111.  
  112.  
  113. for i,v in pairs(char:children()) do
  114. if v:IsA("Hat") then
  115. v:Destroy()
  116. end
  117. end
  118. for i,v in pairs(char:children()) do
  119. if v:IsA("Accessory") then
  120. v:Destroy()
  121. end
  122. end
  123. for i,v in pairs(char:children()) do
  124. if v:IsA("Hair") then
  125. v:Destroy()
  126. end
  127. end
  128. --141378828
  129. Reaper = Instance.new("Model")
  130. Reaper.Parent = Player.Character
  131. Reaper.Name = "Reaper"
  132. rh = Instance.new("Part")
  133. rh.Parent = Reaper
  134. rh.BrickColor = BrickColor.new("Really red")
  135. rh.Locked = true
  136. rh.CanCollide = false
  137. mesh = Instance.new("SpecialMesh")
  138. rh.formFactor = "Symmetric"
  139. mesh.MeshType = "FileMesh"
  140. mesh.MeshId = "http://www.roblox.com/asset/?id=112643970"
  141. mesh.TextureId = "http://www.roblox.com/asset/?id=1018233493"
  142. mesh.Parent = rh
  143. mesh.Scale = Vector3.new(1.1,1.1,1.1)
  144. local weld = Instance.new("Weld")
  145. weld.Parent = rh
  146. rh.Transparency = 0
  147. weld.Part0 = rh
  148. weld.Part1 = Player.Character.Head
  149. weld.C0 = CFrame.new(-0, -0.05, -0)*CFrame.Angles(0, 0, 0)
  150.  
  151. local s = Instance.new("Sound",char)
  152. s.SoundId = "http://www.roblox.com/asset/?id=565420180"
  153. s.Pitch = 1
  154. s.Volume = 2
  155. s.Looped = true
  156. wait(1)
  157. s:play()
  158. local txtfag = Instance.new("BillboardGui", game.Players.LocalPlayer.Character.Head)
  159. txtfag.Adornee = suckadick
  160. txtfag.Name = "kys nigga"
  161. txtfag.Size = UDim2.new(2, 0, 1.2, 0)
  162. txtfag.StudsOffset = Vector3.new(-5, 3, 0)
  163. local textfag = Instance.new("TextLabel", txtfag)
  164. textfag.Size = UDim2.new(6, 0, 1, 0)
  165. textfag.FontSize = "Size8"
  166. textfag.TextScaled = true
  167. textfag.TextTransparency = 0
  168. textfag.BackgroundTransparency = 1
  169. textfag.TextTransparency = 0
  170. textfag.TextStrokeTransparency = 0
  171. textfag.Font = "Cartoon"
  172. textfag.TextStrokeColor3 = Color3.new(0, 0, 0)
  173. textfag.Text = game.Players.LocalPlayer.Character.Name.." the Anti-Skid "
  174.  
  175.  
  176. local runDummyScript = function(f,scri)
  177. local oldenv = getfenv(f)
  178. local newenv = setmetatable({}, {
  179. __index = function(_, k)
  180. if k:lower() == 'script' then
  181. return scri
  182. else
  183. return oldenv[k]
  184. end
  185. end
  186. })
  187. setfenv(f, newenv)
  188. ypcall(function() f() end)
  189. end
  190. cors = {}
  191. mas = Instance.new("Model",game:GetService("Lighting"))
  192. mas.Name = "CompiledModel"
  193. o1 = Instance.new("Tool")
  194. o2 = Instance.new("Part")
  195. o3 = Instance.new("SpecialMesh")
  196. o4 = Instance.new("Sound")
  197. o5 = Instance.new("Sound")
  198. o6 = Instance.new("Sound")
  199. o7 = Instance.new("PointLight")
  200. o8 = Instance.new("Sound")
  201. o10 = Instance.new("LocalScript")
  202. o11 = Instance.new("Animation")
  203. o12 = Instance.new("ScreenGui")
  204. o13 = Instance.new("Frame")
  205. o14 = Instance.new("TextLabel")
  206. o15 = Instance.new("TextLabel")
  207. o16 = Instance.new("TextLabel")
  208. o17 = Instance.new("Frame")
  209. o18 = Instance.new("Frame")
  210. o19 = Instance.new("Frame")
  211. o20 = Instance.new("Frame")
  212. o21 = Instance.new("ImageLabel")
  213. o22 = Instance.new("TextLabel")
  214. o23 = Instance.new("Frame")
  215. o24 = Instance.new("Frame")
  216. o25 = Instance.new("TextLabel")
  217. o26 = Instance.new("LocalScript")
  218. o1.Name = "AUG"
  219. o1.Parent = game.Players.LocalPlayer.Backpack
  220. o1.TextureId = "http://www.roblox.com/asset/?id=122079912"
  221. o1.GripForward = Vector3.new(-0.242535636, -0, -0.970142484)
  222. o1.GripPos = Vector3.new(0.200000003, -0.400000006, 0.200000003)
  223. o1.GripRight = Vector3.new(0.970142484, 0, -0.242535636)
  224. o1.ToolTip = "Steyr AUG"
  225. o1.CanBeDropped = false
  226. o2.Name = "Handle"
  227. o2.Parent = o1
  228. o2.BrickColor = BrickColor.new("Black")
  229. o2.Position = Vector3.new(15.9000006, -8.5, 3.20000005)
  230. o2.FormFactor = Enum.FormFactor.Custom
  231. o2.Size = Vector3.new(0.200000003, 1, 3.5999999)
  232. o2.CFrame = CFrame.new(15.9000006, -8.5, 3.20000005, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  233. o2.BottomSurface = Enum.SurfaceType.Smooth
  234. o2.TopSurface = Enum.SurfaceType.Smooth
  235. o2.Color = Color3.new(0.105882, 0.164706, 0.207843)
  236. o2.Position = Vector3.new(15.9000006, -8.5, 3.20000005)
  237. o3.Parent = o2
  238. o3.MeshId = "http://www.roblox.com/asset/?id=3824738"
  239. o3.Scale = Vector3.new(1.33000004, 1.33000004, 1.33000004)
  240. o3.TextureId = "http://www.roblox.com/asset?ID=3824735 "
  241. o3.MeshType = Enum.MeshType.FileMesh
  242. o4.Name = "FireSound"
  243. o4.Parent = o2
  244. o4.Pitch = 1.3999999761581
  245. o4.SoundId = "http://www.roblox.com/asset/?id=10209859 "
  246. o4.Volume = 1
  247. o5.Name = "Reload"
  248. o5.Parent = o2
  249. o5.SoundId = "http://www.roblox.com/asset/?id=2691591"
  250. o5.Volume = 1
  251. o6.Name = "EquipSound"
  252. o6.Parent = o2
  253. o6.SoundId = "http://www.roblox.com/asset/?id=10209881"
  254. o6.Volume = 1
  255. o7.Name = "Flash"
  256. o7.Parent = o2
  257. o7.Color = Color3.new(1, 1, 0)
  258. o7.Enabled = false
  259. o7.Brightness = 1.5
  260. o8.Name = "Tick"
  261. o8.Parent = o2
  262. o8.SoundId = "rbxasset://sounds//clickfast.wav"
  263. o8.Volume = 1
  264. o10.Name = "AUG"
  265. o10.Parent = o1
  266. print("Giving "..game.Players.LocalPlayer.Name.. " an " ..o1.Name.. " Don't leak this. If you do i will fucking shoot you till your dead ;\ ")
  267. table.insert(cors,coroutine.create(function()
  268. wait()
  269. runDummyScript(function()
  270. --------------------- TEMPLATE ASSAULT RIFLE WEAPON ---------------------------
  271. -- Waits for the child of the specified parent
  272. local function WaitForChild(parent, childName)
  273. while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
  274. return parent[childName]
  275. end
  276.  
  277. ----- MAGIC NUMBERS ABOUT THE TOOL -----
  278. -- How much damage a bullet does
  279. local Damage = 65
  280. -- How many times per second the gun can fire
  281. local FireRate = 1 / 15
  282. -- The maximum distance the can can shoot, this value should never go above 1000
  283. local Range = 700
  284. -- In radians the minimum accuracy penalty
  285. local MinSpread = 0.01
  286. -- In radian the maximum accuracy penalty
  287. local MaxSpread = 0.06
  288. -- Number of bullets in a clip
  289. local ClipSize = 30
  290. -- DefaultValue for spare ammo
  291. local SpareAmmo = math.huge
  292. -- The amount the aim will increase or decrease by
  293. -- decreases this number reduces the speed that recoil takes effect
  294. local AimInaccuracyStepAmount = 0.01
  295. -- Time it takes to reload weapon
  296. local ReloadTime = 2.3
  297. ----------------------------------------
  298.  
  299. -- Colors
  300. local FriendlyReticleColor = Color3.new(0, 1, 0)
  301. local EnemyReticleColor = Color3.new(1, 0, 0)
  302. local NeutralReticleColor = Color3.new(1, 1, 1)
  303.  
  304. local Spread = MinSpread
  305. local AmmoInClip = ClipSize
  306.  
  307. local Tool = o1
  308. local Handle = WaitForChild(Tool, 'Handle')
  309. local WeaponGui = nil
  310.  
  311. local LeftButtonDown
  312. local Reloading = false
  313. local IsShooting = false
  314.  
  315. -- Player specific convenience variables
  316. local MyPlayer = nil
  317. local MyCharacter = nil
  318. local MyHumanoid = nil
  319. local MyTorso = nil
  320. local MyMouse = nil
  321.  
  322. local RecoilAnim
  323. local RecoilTrack = nil
  324.  
  325. local IconURL = Tool.TextureId -- URL to the weapon icon asset
  326.  
  327. local DebrisService = game:GetService('Debris')
  328. local PlayersService = game:GetService('Players')
  329.  
  330.  
  331. local FireSound
  332.  
  333. local OnFireConnection = nil
  334. local OnReloadConnection = nil
  335.  
  336. local DecreasedAimLastShot = false
  337. local LastSpreadUpdate = time()
  338.  
  339. -- this is a dummy object that holds the flash made when the gun is fired
  340. local FlashHolder = nil
  341.  
  342.  
  343. local WorldToCellFunction = Workspace.Terrain.WorldToCellPreferSolid
  344. local GetCellFunction = Workspace.Terrain.GetCell
  345.  
  346. function RayIgnoreCheck(hit, pos)
  347. if hit then
  348. if hit.Transparency >= 1 or string.lower(hit.Name) == "water" or
  349. hit.Name == "Effect" or hit.Name == "Rocket" or hit.Name == "Bullet" or
  350. hit.Name == "Handle" or hit:IsDescendantOf(MyCharacter) then
  351. return true
  352. elseif hit:IsA('Terrain') and pos then
  353. local cellPos = WorldToCellFunction(Workspace.Terrain, pos)
  354. if cellPos then
  355. local cellMat = GetCellFunction(Workspace.Terrain, cellPos.x, cellPos.y, cellPos.z)
  356. if cellMat and cellMat == Enum.CellMaterial.Water then
  357. return true
  358. end
  359. end
  360. end
  361. end
  362. return false
  363. end
  364.  
  365. -- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000
  366. function RayCast(startPos, vec, rayLength)
  367. local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle)
  368. if hitObject and hitPos then
  369. local distance = rayLength - (hitPos - startPos).magnitude
  370. if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then
  371. -- there is a chance here for potential infinite recursion
  372. return RayCast(hitPos, vec, distance)
  373. end
  374. end
  375. return hitObject, hitPos
  376. end
  377.  
  378.  
  379.  
  380. function TagHumanoid(humanoid, player)
  381. -- Add more tags here to customize what tags are available.
  382. while humanoid:FindFirstChild('creator') do
  383. humanoid:FindFirstChild('creator'):Destroy()
  384. end
  385. local creatorTag = Instance.new("ObjectValue")
  386. creatorTag.Value = player
  387. creatorTag.Name = "creator"
  388. creatorTag.Parent = humanoid
  389. DebrisService:AddItem(creatorTag, 1.5)
  390.  
  391. local weaponIconTag = Instance.new("StringValue")
  392. weaponIconTag.Value = IconURL
  393. weaponIconTag.Name = "icon"
  394. weaponIconTag.Parent = creatorTag
  395. end
  396.  
  397.  
  398. local function CreateBullet(bulletPos)
  399. local bullet = Instance.new('Part', Workspace)
  400. bullet.FormFactor = Enum.FormFactor.Custom
  401. bullet.Size = Vector3.new(0.1, 0.1, 0.1)
  402. bullet.BrickColor = BrickColor.new("Black")
  403. bullet.Shape = Enum.PartType.Block
  404. bullet.CanCollide = false
  405. bullet.CFrame = CFrame.new(bulletPos)
  406. bullet.Anchored = true
  407. bullet.TopSurface = Enum.SurfaceType.Smooth
  408. bullet.BottomSurface = Enum.SurfaceType.Smooth
  409. bullet.Name = 'Bullet'
  410. DebrisService:AddItem(bullet, 2.5)
  411. return bullet
  412. end
  413.  
  414. local function Reload()
  415. if not Reloading then
  416. Reloading = true
  417. -- Don't reload if you are already full or have no extra ammo
  418. if AmmoInClip ~= ClipSize and SpareAmmo > 0 then
  419. if RecoilTrack then
  420. RecoilTrack:Stop()
  421. end
  422. if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
  423. if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
  424. WeaponGui.Crosshair.ReloadingLabel.Visible = true
  425. end
  426. end
  427. script.Parent.Handle.Reload:Play()
  428. wait(ReloadTime)
  429. -- Only use as much ammo as you have
  430. local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo)
  431. AmmoInClip = AmmoInClip + ammoToUse
  432. SpareAmmo = SpareAmmo - ammoToUse
  433. UpdateAmmo(AmmoInClip)
  434. WeaponGui.Reload.Visible = false
  435. end
  436. Reloading = false
  437. end
  438. end
  439.  
  440. function OnFire()
  441. if IsShooting then return end
  442. if MyHumanoid and MyHumanoid.Health > 0 then
  443. if RecoilTrack and AmmoInClip > 0 then
  444. RecoilTrack:Play()
  445. end
  446. IsShooting = true
  447. while LeftButtonDown and AmmoInClip > 0 and not Reloading do
  448. if Spread and not DecreasedAimLastShot then
  449. Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount)
  450. UpdateCrosshair(Spread)
  451. end
  452. DecreasedAimLastShot = not DecreasedAimLastShot
  453. if Handle:FindFirstChild('FireSound') then
  454. Handle.FireSound:Play()
  455. Handle.Flash.Enabled = true
  456. end
  457. if MyMouse then
  458. local targetPoint = MyMouse.Hit.p
  459. local shootDirection = (targetPoint - Handle.Position).unit
  460. -- Adjust the shoot direction randomly off by a little bit to account for recoil
  461. shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
  462. (0.5 - math.random()) * 2 * Spread,
  463. (0.5 - math.random()) * 2 * Spread) * shootDirection
  464. local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
  465. local bullet
  466. -- Create a bullet here
  467. if hitObject then
  468. bullet = CreateBullet(bulletPos)
  469. end
  470. if hitObject and hitObject.Parent then
  471. local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
  472. if hitHumanoid then
  473. local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
  474. if MyPlayer.Neutral or hitPlayer then
  475. TagHumanoid(hitHumanoid, MyPlayer)
  476. hitHumanoid:TakeDamage(Damage)
  477. if bullet then
  478. bullet:Destroy()
  479. bullet = nil
  480. --bullet.Transparency = 1
  481. end
  482. Spawn(UpdateTargetHit)
  483. end
  484. end
  485. end
  486.  
  487. AmmoInClip = AmmoInClip - 1
  488. UpdateAmmo(AmmoInClip)
  489. end
  490. wait(FireRate)
  491. end
  492. Handle.Flash.Enabled = false
  493. IsShooting = false
  494. if AmmoInClip == 0 then
  495. Handle.Tick:Play()
  496. WeaponGui.Reload.Visible = true
  497. end
  498. if RecoilTrack then
  499. RecoilTrack:Stop()
  500. end
  501. end
  502. end
  503.  
  504. local TargetHits = 0
  505. function UpdateTargetHit()
  506. TargetHits = TargetHits + 1
  507. if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
  508. WeaponGui.Crosshair.TargetHitImage.Visible = true
  509. end
  510. wait(0.5)
  511. TargetHits = TargetHits - 1
  512. if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
  513. WeaponGui.Crosshair.TargetHitImage.Visible = false
  514. end
  515. end
  516.  
  517. function UpdateCrosshair(value, mouse)
  518. if WeaponGui then
  519. local absoluteY = 650
  520. WeaponGui.Crosshair:TweenSize(
  521. UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23),
  522. Enum.EasingDirection.Out,
  523. Enum.EasingStyle.Linear,
  524. 0.33)
  525. end
  526. end
  527.  
  528. function UpdateAmmo(value)
  529. if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
  530. WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip
  531. if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
  532. WeaponGui.Crosshair.ReloadingLabel.Visible = false
  533. end
  534. end
  535. if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
  536. WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo
  537. end
  538. end
  539.  
  540.  
  541. function OnMouseDown()
  542. LeftButtonDown = true
  543. OnFire()
  544. end
  545.  
  546. function OnMouseUp()
  547. LeftButtonDown = false
  548. end
  549.  
  550. function OnKeyDown(key)
  551. if string.lower(key) == 'r' then
  552. Reload()
  553. end
  554. end
  555.  
  556.  
  557. function OnEquipped(mouse)
  558. Handle.EquipSound:Play()
  559. RecoilAnim = WaitForChild(Tool, 'Recoil')
  560. FireSound = WaitForChild(Handle, 'FireSound')
  561.  
  562. MyCharacter = Tool.Parent
  563. MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
  564. MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
  565. MyTorso = MyCharacter:FindFirstChild('Torso')
  566. MyMouse = mouse
  567. WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone()
  568. if WeaponGui and MyPlayer then
  569. WeaponGui.Parent = MyPlayer.PlayerGui
  570. UpdateAmmo(AmmoInClip)
  571. end
  572. if RecoilAnim then
  573. RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim)
  574. end
  575.  
  576. if MyMouse then
  577. -- Disable mouse icon
  578. MyMouse.Icon = "http://www.roblox.com/asset/?id=18662154"
  579. MyMouse.Button1Down:connect(OnMouseDown)
  580. MyMouse.Button1Up:connect(OnMouseUp)
  581. MyMouse.KeyDown:connect(OnKeyDown)
  582. end
  583. end
  584.  
  585.  
  586. -- Unequip logic here
  587. function OnUnequipped()
  588. LeftButtonDown = false
  589. Reloading = false
  590. MyCharacter = nil
  591. MyHumanoid = nil
  592. MyTorso = nil
  593. MyPlayer = nil
  594. MyMouse = nil
  595. if OnFireConnection then
  596. OnFireConnection:disconnect()
  597. end
  598. if OnReloadConnection then
  599. OnReloadConnection:disconnect()
  600. end
  601. if FlashHolder then
  602. FlashHolder = nil
  603. end
  604. if WeaponGui then
  605. WeaponGui.Parent = nil
  606. WeaponGui = nil
  607. end
  608. if RecoilTrack then
  609. RecoilTrack:Stop()
  610. end
  611. end
  612.  
  613. local function SetReticleColor(color)
  614. if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
  615. for _, line in pairs(WeaponGui.Crosshair:GetChildren()) do
  616. if line:IsA('Frame') then
  617. line.BorderColor3 = color
  618. end
  619. end
  620. end
  621. end
  622.  
  623.  
  624. Tool.Equipped:connect(OnEquipped)
  625. Tool.Unequipped:connect(OnUnequipped)
  626.  
  627. while true do
  628. wait(0.033)
  629. if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and MyMouse then
  630. WeaponGui.Crosshair.Position = UDim2.new(0, MyMouse.X, 0, MyMouse.Y)
  631. SetReticleColor(NeutralReticleColor)
  632.  
  633. local target = MyMouse.Target
  634. if target and target.Parent then
  635. local player = owner
  636. if player then
  637. if MyPlayer.Neutral or player.TeamColor ~= MyPlayer.TeamColor then
  638. SetReticleColor(EnemyReticleColor)
  639. else
  640. SetReticleColor(FriendlyReticleColor)
  641. end
  642. end
  643. end
  644. end
  645. if Spread and not IsShooting then
  646. local currTime = time()
  647. if currTime - LastSpreadUpdate > FireRate * 2 then
  648. LastSpreadUpdate = currTime
  649. Spread = math.max(MinSpread, Spread - AimInaccuracyStepAmount)
  650. UpdateCrosshair(Spread, MyMouse)
  651. end
  652. end
  653. end
  654.  
  655. end,o10)
  656. end))
  657. o11.Name = "Recoil"
  658. o11.Parent = o1
  659. o11.AnimationId = "http://www.roblox.com/Asset?ID=94331086"
  660. o12.Name = "WeaponHud"
  661. o12.Parent = o1
  662. o13.Name = "AmmoHud"
  663. o13.Parent = o12
  664. o13.Position = UDim2.new(1,-265,1,-60)
  665. o13.Size = UDim2.new(0,200,0,50)
  666. o13.Style = Enum.FrameStyle.RobloxSquare
  667. o13.Position = UDim2.new(1,-265,1,-60)
  668. o13.BackgroundTransparency = 1
  669. o13.BorderSizePixel = 0
  670. o14.Name = "ForwardSlash"
  671. o14.Parent = o13
  672. o14.Position = UDim2.new(0.5,0,0.5,0)
  673. o14.Text = "/"
  674. o14.Position = UDim2.new(0.5,0,0.5,0)
  675. o14.BackgroundTransparency = 1
  676. o14.BorderSizePixel = 0
  677. o14.FontSize = Enum.FontSize.Size24
  678. o14.TextColor3 = Color3.new(1, 1, 1)
  679. o14.TextStrokeTransparency = 0
  680. o15.Name = "ClipAmmo"
  681. o15.Parent = o13
  682. o15.Position = UDim2.new(0.44999998807907,0,0.5,0)
  683. o15.Text = "54"
  684. o15.Position = UDim2.new(0.44999998807907,0,0.5,0)
  685. o15.BackgroundTransparency = 1
  686. o15.BorderSizePixel = 0
  687. o15.FontSize = Enum.FontSize.Size24
  688. o15.TextColor3 = Color3.new(1, 1, 1)
  689. o15.TextStrokeTransparency = 0
  690. o15.TextXAlignment = Enum.TextXAlignment.Right
  691. o16.Name = "TotalAmmo"
  692. o16.Parent = o13
  693. o16.Position = UDim2.new(0.55000001192093,0,0.5,0)
  694. o16.Text = "180"
  695. o16.Position = UDim2.new(0.55000001192093,0,0.5,0)
  696. o16.BackgroundTransparency = 1
  697. o16.BorderSizePixel = 0
  698. o16.FontSize = Enum.FontSize.Size24
  699. o16.TextColor3 = Color3.new(1, 1, 1)
  700. o16.TextStrokeTransparency = 0
  701. o16.TextXAlignment = Enum.TextXAlignment.Left
  702. o17.Name = "Crosshair"
  703. o17.Parent = o12
  704. o17.Position = UDim2.new(0,500,0,500)
  705. o17.Size = UDim2.new(0,150,0,150)
  706. o17.Position = UDim2.new(0,500,0,500)
  707. o17.BackgroundColor3 = Color3.new(0, 1, 0)
  708. o17.BackgroundTransparency = 1
  709. o17.BorderSizePixel = 0
  710. o18.Name = "TopFrame"
  711. o18.Parent = o17
  712. o18.Position = UDim2.new(0,-1,-0.5,-7)
  713. o18.Size = UDim2.new(0,2,0,14)
  714. o18.Position = UDim2.new(0,-1,-0.5,-7)
  715. o18.BackgroundColor3 = Color3.new(1, 1, 1)
  716. o18.BorderColor3 = Color3.new(0, 0, 0)
  717. o19.Name = "RightFrame"
  718. o19.Parent = o17
  719. o19.Position = UDim2.new(0.5,-7,0,-1)
  720. o19.Size = UDim2.new(0,14,0,2)
  721. o19.Position = UDim2.new(0.5,-7,0,-1)
  722. o19.BackgroundColor3 = Color3.new(1, 1, 1)
  723. o19.BorderColor3 = Color3.new(0, 0, 0)
  724. o20.Name = "LeftFrame"
  725. o20.Parent = o17
  726. o20.Position = UDim2.new(-0.5,-7,0,-1)
  727. o20.Size = UDim2.new(0,14,0,2)
  728. o20.Position = UDim2.new(-0.5,-7,0,-1)
  729. o20.BackgroundColor3 = Color3.new(1, 1, 1)
  730. o20.BorderColor3 = Color3.new(0, 0, 0)
  731. o21.Name = "TargetHitImage"
  732. o21.Parent = o17
  733. o21.Position = UDim2.new(0,-25,0,-25)
  734. o21.Size = UDim2.new(0,50,0,50)
  735. o21.Position = UDim2.new(0,-25,0,-25)
  736. o21.Visible = false
  737. o21.BackgroundTransparency = 1
  738. o21.BorderSizePixel = 0
  739. o21.Image = "http://www.roblox.com/asset/?id=115400215"
  740. o22.Name = "ReloadingLabel"
  741. o22.Parent = o17
  742. o22.Position = UDim2.new(0,20,0,-20)
  743. o22.Text = "Reloading"
  744. o22.Position = UDim2.new(0,20,0,-20)
  745. o22.Visible = false
  746. o22.BackgroundTransparency = 1
  747. o22.BorderSizePixel = 0
  748. o22.Font = Enum.Font.ArialBold
  749. o22.FontSize = Enum.FontSize.Size18
  750. o22.TextColor3 = Color3.new(1, 1, 1)
  751. o22.TextStrokeTransparency = 0
  752. o22.TextXAlignment = Enum.TextXAlignment.Left
  753. o22.TextYAlignment = Enum.TextYAlignment.Bottom
  754. o23.Name = "BottomFrame"
  755. o23.Parent = o17
  756. o23.Position = UDim2.new(0,-1,0.5,-7)
  757. o23.Size = UDim2.new(0,2,0,14)
  758. o23.Position = UDim2.new(0,-1,0.5,-7)
  759. o23.BackgroundColor3 = Color3.new(1, 1, 1)
  760. o23.BorderColor3 = Color3.new(0, 0, 0)
  761. o24.Name = "Reload"
  762. o24.Parent = o12
  763. o24.Position = UDim2.new(1,-265,1,-120)
  764. o24.Size = UDim2.new(0,200,0,50)
  765. o24.Position = UDim2.new(1,-265,1,-120)
  766. o24.Visible = false
  767. o24.BackgroundTransparency = 1
  768. o24.BorderSizePixel = 0
  769. o25.Name = "Reload"
  770. o25.Parent = o24
  771. o25.Position = UDim2.new(0.5,0,0.5,0)
  772. o25.Text = "Press R to Reload"
  773. o25.Position = UDim2.new(0.5,0,0.5,0)
  774. o25.BackgroundTransparency = 1
  775. o25.BorderSizePixel = 0
  776. o25.Font = Enum.Font.ArialBold
  777. o25.FontSize = Enum.FontSize.Size24
  778. o25.TextColor3 = Color3.new(1, 0, 0)
  779. o25.TextStrokeTransparency = 0
  780. o26.Name = "ArmWeld [Rifle]"
  781. o26.Parent = o1
  782. table.insert(cors,coroutine.create(function()
  783. wait()
  784. runDummyScript(function()
  785. Tool = script.Parent;
  786.  
  787. local arms = nil
  788. local torso = nil
  789. local welds = {}
  790.  
  791. function Equip(mouse)
  792. wait(0.01)
  793. arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
  794. torso = Tool.Parent:FindFirstChild("Torso")
  795. if arms ~= nil and torso ~= nil then
  796. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  797. if sh ~= nil then
  798. local yes = true
  799. if yes then
  800. yes = false
  801. sh[1].Part1 = nil
  802. sh[2].Part1 = nil
  803. local weld1 = Instance.new("Weld")
  804. weld1.Part0 = torso
  805. weld1.Parent = torso
  806. weld1.Part1 = arms[1]
  807. 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
  808. welds[1] = weld1
  809. weld1.Name = "weld1"
  810. local weld2 = Instance.new("Weld")
  811. weld2.Part0 = torso
  812. weld2.Parent = torso
  813. weld2.Part1 = arms[2]
  814. weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0) --- Same as top
  815. welds[2] = weld2
  816. weld2.Name = "weld2"
  817. end
  818. else
  819. print("sh")
  820. end
  821. else
  822. print("arms")
  823. end
  824. end
  825.  
  826. function Unequip(mouse)
  827. if arms ~= nil and torso ~= nil then
  828. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  829. if sh ~= nil then
  830. local yes = true
  831. if yes then
  832. yes = false
  833. sh[1].Part1 = arms[1]
  834. sh[2].Part1 = arms[2]
  835. welds[1].Parent = nil
  836. welds[2].Parent = nil
  837. end
  838. else
  839. print("sh")
  840. end
  841. else
  842. print("arms")
  843. end
  844. end
  845. Tool.Equipped:connect(Equip)
  846. Tool.Unequipped:connect(Unequip)
  847.  
  848. end,o26)
  849. end))
  850. mas.Parent = workspace
  851. mas:MakeJoints()
  852. local mas1 = mas:GetChildren()
  853. for i=1,#mas1 do
  854. mas1[i].Parent = workspace
  855. ypcall(function() mas1[i]:MakeJoints() end)
  856. end
  857. mas:Destroy()
  858. for i=1,#cors do
  859. coroutine.resume(cors[i])
  860. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement