Advertisement
wamandnj

Untitled

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