Advertisement
Void_scripter0

anti skid

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