Advertisement
Guest User

Untitled

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