Advertisement
AsukaOS

Fe The Last Oder

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