lotushomerun

AUG Script(Roblox)

May 20th, 2017
638
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 19.99 KB | None | 0 0
  1. --An AUG ^-^
  2. --Has a 30 round magazine and does lots of damage
  3. --Don't leak this. If you do i will fucking shoot you till your dead :\
  4. local runDummyScript = function(f,scri)
  5. local oldenv = getfenv(f)
  6. local newenv = setmetatable({}, {
  7. __index = function(_, k)
  8. if k:lower() == 'script' then
  9. return scri
  10. else
  11. return oldenv[k]
  12. end
  13. end
  14. })
  15. setfenv(f, newenv)
  16. ypcall(function() f() end)
  17. end
  18. cors = {}
  19. mas = Instance.new("Model",game:GetService("Lighting"))
  20. mas.Name = "CompiledModel"
  21. o1 = Instance.new("Tool")
  22. o2 = Instance.new("Part")
  23. o3 = Instance.new("SpecialMesh")
  24. o4 = Instance.new("Sound")
  25. o5 = Instance.new("Sound")
  26. o6 = Instance.new("Sound")
  27. o7 = Instance.new("PointLight")
  28. o8 = Instance.new("Sound")
  29. o10 = Instance.new("LocalScript")
  30. o11 = Instance.new("Animation")
  31. o12 = Instance.new("ScreenGui")
  32. o13 = Instance.new("Frame")
  33. o14 = Instance.new("TextLabel")
  34. o15 = Instance.new("TextLabel")
  35. o16 = Instance.new("TextLabel")
  36. o17 = Instance.new("Frame")
  37. o18 = Instance.new("Frame")
  38. o19 = Instance.new("Frame")
  39. o20 = Instance.new("Frame")
  40. o21 = Instance.new("ImageLabel")
  41. o22 = Instance.new("TextLabel")
  42. o23 = Instance.new("Frame")
  43. o24 = Instance.new("Frame")
  44. o25 = Instance.new("TextLabel")
  45. o26 = Instance.new("LocalScript")
  46. o1.Name = "AUG"
  47. o1.Parent = game.Players.LocalPlayer.Backpack
  48. o1.TextureId = "http://www.roblox.com/asset/?id=122079912"
  49. o1.GripForward = Vector3.new(-0.242535636, -0, -0.970142484)
  50. o1.GripPos = Vector3.new(0.200000003, -0.400000006, 0.200000003)
  51. o1.GripRight = Vector3.new(0.970142484, 0, -0.242535636)
  52. o1.ToolTip = "Steyr AUG"
  53. o1.CanBeDropped = false
  54. o2.Name = "Handle"
  55. o2.Parent = o1
  56. o2.BrickColor = BrickColor.new("Black")
  57. o2.Position = Vector3.new(15.9000006, -8.5, 3.20000005)
  58. o2.FormFactor = Enum.FormFactor.Custom
  59. o2.Size = Vector3.new(0.200000003, 1, 3.5999999)
  60. o2.CFrame = CFrame.new(15.9000006, -8.5, 3.20000005, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  61. o2.BottomSurface = Enum.SurfaceType.Smooth
  62. o2.TopSurface = Enum.SurfaceType.Smooth
  63. o2.Color = Color3.new(0.105882, 0.164706, 0.207843)
  64. o2.Position = Vector3.new(15.9000006, -8.5, 3.20000005)
  65. o3.Parent = o2
  66. o3.MeshId = "http://www.roblox.com/asset/?id=3824738"
  67. o3.Scale = Vector3.new(1.33000004, 1.33000004, 1.33000004)
  68. o3.TextureId = "http://www.roblox.com/asset?ID=3824735 "
  69. o3.MeshType = Enum.MeshType.FileMesh
  70. o4.Name = "FireSound"
  71. o4.Parent = o2
  72. o4.Pitch = 1.3999999761581
  73. o4.SoundId = "http://www.roblox.com/asset/?id=10209859 "
  74. o4.Volume = 1
  75. o5.Name = "Reload"
  76. o5.Parent = o2
  77. o5.SoundId = "http://www.roblox.com/asset/?id=2691591"
  78. o5.Volume = 1
  79. o6.Name = "EquipSound"
  80. o6.Parent = o2
  81. o6.SoundId = "http://www.roblox.com/asset/?id=10209881"
  82. o6.Volume = 1
  83. o7.Name = "Flash"
  84. o7.Parent = o2
  85. o7.Color = Color3.new(1, 1, 0)
  86. o7.Enabled = false
  87. o7.Brightness = 1.5
  88. o8.Name = "Tick"
  89. o8.Parent = o2
  90. o8.SoundId = "rbxasset://sounds//clickfast.wav"
  91. o8.Volume = 1
  92. o10.Name = "AUG"
  93. o10.Parent = o1
  94. print("Giving "..game.Players.LocalPlayer.Name.. " an " ..o1.Name.. " Don't leak this. If you do i will fucking shoot you till your dead ;\ ")
  95. table.insert(cors,coroutine.create(function()
  96. wait()
  97. runDummyScript(function()
  98. --------------------- TEMPLATE ASSAULT RIFLE WEAPON ---------------------------
  99. -- Waits for the child of the specified parent
  100. local function WaitForChild(parent, childName)
  101.     while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
  102.     return parent[childName]
  103. end
  104.  
  105. ----- MAGIC NUMBERS ABOUT THE TOOL -----
  106. -- How much damage a bullet does
  107. local Damage = 65
  108. -- How many times per second the gun can fire
  109. local FireRate = 1 / 15
  110. -- The maximum distance the can can shoot, this value should never go above 1000
  111. local Range = 700
  112. -- In radians the minimum accuracy penalty
  113. local MinSpread = 0.01
  114. -- In radian the maximum accuracy penalty
  115. local MaxSpread = 0.06
  116. -- Number of bullets in a clip
  117. local ClipSize = 30
  118. -- DefaultValue for spare ammo
  119. local SpareAmmo = math.huge
  120. -- The amount the aim will increase or decrease by
  121. -- decreases this number reduces the speed that recoil takes effect
  122. local AimInaccuracyStepAmount = 0.01
  123. -- Time it takes to reload weapon
  124. local ReloadTime = 2.3
  125. ----------------------------------------
  126.  
  127. -- Colors
  128. local FriendlyReticleColor = Color3.new(0, 1, 0)
  129. local EnemyReticleColor = Color3.new(1, 0, 0)
  130. local NeutralReticleColor   = Color3.new(1, 1, 1)
  131.  
  132. local Spread = MinSpread
  133. local AmmoInClip = ClipSize
  134.  
  135. local Tool = o1
  136. local Handle = WaitForChild(Tool, 'Handle')
  137. local WeaponGui = nil
  138.  
  139. local LeftButtonDown
  140. local Reloading = false
  141. local IsShooting = false
  142.  
  143. -- Player specific convenience variables
  144. local MyPlayer = nil
  145. local MyCharacter = nil
  146. local MyHumanoid = nil
  147. local MyTorso = nil
  148. local MyMouse = nil
  149.  
  150. local RecoilAnim
  151. local RecoilTrack = nil
  152.  
  153. local IconURL = Tool.TextureId  -- URL to the weapon icon asset
  154.  
  155. local DebrisService = game:GetService('Debris')
  156. local PlayersService = game:GetService('Players')
  157.  
  158.  
  159. local FireSound
  160.  
  161. local OnFireConnection = nil
  162. local OnReloadConnection = nil
  163.  
  164. local DecreasedAimLastShot = false
  165. local LastSpreadUpdate = time()
  166.  
  167. -- this is a dummy object that holds the flash made when the gun is fired
  168. local FlashHolder = nil
  169.  
  170.  
  171. local WorldToCellFunction = Workspace.Terrain.WorldToCellPreferSolid
  172. local GetCellFunction = Workspace.Terrain.GetCell
  173.  
  174. function RayIgnoreCheck(hit, pos)
  175.     if hit then
  176.         if hit.Transparency >= 1 or string.lower(hit.Name) == "water" or
  177.                 hit.Name == "Effect" or hit.Name == "Rocket" or hit.Name == "Bullet" or
  178.                 hit.Name == "Handle" or hit:IsDescendantOf(MyCharacter) then
  179.             return true
  180.         elseif hit:IsA('Terrain') and pos then
  181.             local cellPos = WorldToCellFunction(Workspace.Terrain, pos)
  182.             if cellPos then
  183.                 local cellMat = GetCellFunction(Workspace.Terrain, cellPos.x, cellPos.y, cellPos.z)
  184.                 if cellMat and cellMat == Enum.CellMaterial.Water then
  185.                     return true
  186.                 end
  187.             end
  188.         end
  189.     end
  190.     return false
  191. end
  192.  
  193. -- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000
  194. function RayCast(startPos, vec, rayLength)
  195.     local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle)
  196.     if hitObject and hitPos then
  197.         local distance = rayLength - (hitPos - startPos).magnitude
  198.         if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then
  199.             -- there is a chance here for potential infinite recursion
  200.             return RayCast(hitPos, vec, distance)
  201.         end
  202.     end
  203.     return hitObject, hitPos
  204. end
  205.  
  206.  
  207.  
  208. function TagHumanoid(humanoid, player)
  209.     -- Add more tags here to customize what tags are available.
  210.     while humanoid:FindFirstChild('creator') do
  211.         humanoid:FindFirstChild('creator'):Destroy()
  212.     end
  213.     local creatorTag = Instance.new("ObjectValue")
  214.     creatorTag.Value = player
  215.     creatorTag.Name = "creator"
  216.     creatorTag.Parent = humanoid
  217.     DebrisService:AddItem(creatorTag, 1.5)
  218.  
  219.     local weaponIconTag = Instance.new("StringValue")
  220.     weaponIconTag.Value = IconURL
  221.     weaponIconTag.Name = "icon"
  222.     weaponIconTag.Parent = creatorTag
  223. end
  224.  
  225.  
  226. local function CreateBullet(bulletPos)
  227.     local bullet = Instance.new('Part', Workspace)
  228.     bullet.FormFactor = Enum.FormFactor.Custom
  229.     bullet.Size = Vector3.new(0.1, 0.1, 0.1)
  230.     bullet.BrickColor = BrickColor.new("Black")
  231.     bullet.Shape = Enum.PartType.Block
  232.     bullet.CanCollide = false
  233.     bullet.CFrame = CFrame.new(bulletPos)
  234.     bullet.Anchored = true
  235.     bullet.TopSurface = Enum.SurfaceType.Smooth
  236.     bullet.BottomSurface = Enum.SurfaceType.Smooth
  237.     bullet.Name = 'Bullet'
  238.     DebrisService:AddItem(bullet, 2.5)
  239.     return bullet
  240. end
  241.  
  242. local function Reload()
  243.     if not Reloading then
  244.         Reloading = true
  245.         -- Don't reload if you are already full or have no extra ammo
  246.         if AmmoInClip ~= ClipSize and SpareAmmo > 0 then
  247.             if RecoilTrack then
  248.                 RecoilTrack:Stop()
  249.             end
  250.             if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
  251.                 if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
  252.                     WeaponGui.Crosshair.ReloadingLabel.Visible = true
  253.                 end
  254.             end
  255.             script.Parent.Handle.Reload:Play()
  256.             wait(ReloadTime)
  257.             -- Only use as much ammo as you have
  258.             local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo)
  259.             AmmoInClip = AmmoInClip + ammoToUse
  260.             SpareAmmo = SpareAmmo - ammoToUse
  261.             UpdateAmmo(AmmoInClip)
  262.             WeaponGui.Reload.Visible = false
  263.         end
  264.         Reloading = false
  265.     end
  266. end
  267.  
  268. function OnFire()
  269.     if IsShooting then return end
  270.     if MyHumanoid and MyHumanoid.Health > 0 then
  271.         if RecoilTrack and AmmoInClip > 0 then
  272.             RecoilTrack:Play()
  273.         end
  274.         IsShooting = true
  275.         while LeftButtonDown and AmmoInClip > 0 and not Reloading do
  276.             if Spread and not DecreasedAimLastShot then
  277.                 Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount)
  278.                 UpdateCrosshair(Spread)
  279.             end
  280.             DecreasedAimLastShot = not DecreasedAimLastShot
  281.             if Handle:FindFirstChild('FireSound') then
  282.                 Handle.FireSound:Play()
  283.                 Handle.Flash.Enabled = true
  284.             end
  285.             if MyMouse then
  286.                 local targetPoint = MyMouse.Hit.p
  287.                 local shootDirection = (targetPoint - Handle.Position).unit
  288.                 -- Adjust the shoot direction randomly off by a little bit to account for recoil
  289.                 shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
  290.                                                                 (0.5 - math.random()) * 2 * Spread,
  291.                                                                 (0.5 - math.random()) * 2 * Spread) * shootDirection
  292.                 local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
  293.                 local bullet
  294.                 -- Create a bullet here
  295.                 if hitObject then
  296.                     bullet = CreateBullet(bulletPos)
  297.                 end
  298.                 if hitObject and hitObject.Parent then
  299.                     local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
  300.                     if hitHumanoid then
  301.                         local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
  302.                         if MyPlayer.Neutral or hitPlayer then
  303.                             TagHumanoid(hitHumanoid, MyPlayer)
  304.                             hitHumanoid:TakeDamage(Damage)
  305.                             if bullet then
  306.                                 bullet:Destroy()
  307.                                 bullet = nil
  308.                                 --bullet.Transparency = 1
  309.                             end
  310.                             Spawn(UpdateTargetHit)
  311.                         end
  312.                     end
  313.                 end
  314.    
  315.                 AmmoInClip = AmmoInClip - 1
  316.                 UpdateAmmo(AmmoInClip)
  317.             end
  318.             wait(FireRate)
  319.         end
  320.         Handle.Flash.Enabled = false
  321.         IsShooting = false
  322.         if AmmoInClip == 0 then
  323.             Handle.Tick:Play()
  324.             WeaponGui.Reload.Visible = true
  325.         end
  326.         if RecoilTrack then
  327.             RecoilTrack:Stop()
  328.         end
  329.     end
  330. end
  331.  
  332. local TargetHits = 0
  333. function UpdateTargetHit()
  334.     TargetHits = TargetHits + 1
  335.     if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
  336.         WeaponGui.Crosshair.TargetHitImage.Visible = true
  337.     end
  338.     wait(0.5)
  339.     TargetHits = TargetHits - 1
  340.     if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
  341.         WeaponGui.Crosshair.TargetHitImage.Visible = false
  342.     end
  343. end
  344.  
  345. function UpdateCrosshair(value, mouse)
  346.     if WeaponGui then
  347.         local absoluteY = 650
  348.         WeaponGui.Crosshair:TweenSize(
  349.             UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23),
  350.             Enum.EasingDirection.Out,
  351.             Enum.EasingStyle.Linear,
  352.             0.33)
  353.     end
  354. end
  355.  
  356. function UpdateAmmo(value)
  357.     if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
  358.         WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip
  359.         if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
  360.             WeaponGui.Crosshair.ReloadingLabel.Visible = false
  361.         end
  362.     end
  363.     if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
  364.         WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo
  365.     end
  366. end
  367.  
  368.  
  369. function OnMouseDown()
  370.     LeftButtonDown = true
  371.     OnFire()
  372. end
  373.  
  374. function OnMouseUp()
  375.     LeftButtonDown = false
  376. end
  377.  
  378. function OnKeyDown(key)
  379.     if string.lower(key) == 'r' then
  380.         Reload()
  381.     end
  382. end
  383.  
  384.  
  385. function OnEquipped(mouse)
  386.     Handle.EquipSound:Play()
  387.     RecoilAnim = WaitForChild(Tool, 'Recoil')
  388.     FireSound  = WaitForChild(Handle, 'FireSound')
  389.  
  390.     MyCharacter = Tool.Parent
  391.     MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
  392.     MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
  393.     MyTorso = MyCharacter:FindFirstChild('Torso')
  394.     MyMouse = mouse
  395.     WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone()
  396.     if WeaponGui and MyPlayer then
  397.         WeaponGui.Parent = MyPlayer.PlayerGui
  398.         UpdateAmmo(AmmoInClip)
  399.     end
  400.     if RecoilAnim then
  401.         RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim)
  402.     end
  403.  
  404.     if MyMouse then
  405.         -- Disable mouse icon
  406.         MyMouse.Icon = "http://www.roblox.com/asset/?id=18662154"
  407.         MyMouse.Button1Down:connect(OnMouseDown)
  408.         MyMouse.Button1Up:connect(OnMouseUp)
  409.         MyMouse.KeyDown:connect(OnKeyDown)
  410.     end
  411. end
  412.  
  413.  
  414. -- Unequip logic here
  415. function OnUnequipped()
  416.     LeftButtonDown = false
  417.     Reloading = false
  418.     MyCharacter = nil
  419.     MyHumanoid = nil
  420.     MyTorso = nil
  421.     MyPlayer = nil
  422.     MyMouse = nil
  423.     if OnFireConnection then
  424.         OnFireConnection:disconnect()
  425.     end
  426.     if OnReloadConnection then
  427.         OnReloadConnection:disconnect()
  428.     end
  429.     if FlashHolder then
  430.         FlashHolder = nil
  431.     end
  432.     if WeaponGui then
  433.         WeaponGui.Parent = nil
  434.         WeaponGui = nil
  435.     end
  436.     if RecoilTrack then
  437.         RecoilTrack:Stop()
  438.     end
  439. end
  440.  
  441. local function SetReticleColor(color)
  442.     if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
  443.         for _, line in pairs(WeaponGui.Crosshair:GetChildren()) do
  444.             if line:IsA('Frame') then
  445.                 line.BorderColor3 = color
  446.             end
  447.         end
  448.     end
  449. end
  450.  
  451.  
  452. Tool.Equipped:connect(OnEquipped)
  453. Tool.Unequipped:connect(OnUnequipped)
  454.  
  455. while true do
  456.     wait(0.033)
  457.     if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and MyMouse then
  458.         WeaponGui.Crosshair.Position = UDim2.new(0, MyMouse.X, 0, MyMouse.Y)
  459.         SetReticleColor(NeutralReticleColor)
  460.  
  461.         local target = MyMouse.Target
  462.         if target and target.Parent then
  463.             local player = PlayersService:GetPlayerFromCharacter(target.Parent)
  464.             if player then
  465.                 if MyPlayer.Neutral or player.TeamColor ~= MyPlayer.TeamColor then
  466.                     SetReticleColor(EnemyReticleColor)
  467.                 else
  468.                     SetReticleColor(FriendlyReticleColor)
  469.                 end
  470.             end
  471.         end
  472.     end
  473.     if Spread and not IsShooting then
  474.         local currTime = time()
  475.         if currTime - LastSpreadUpdate > FireRate * 2 then
  476.             LastSpreadUpdate = currTime
  477.             Spread = math.max(MinSpread, Spread - AimInaccuracyStepAmount)
  478.             UpdateCrosshair(Spread, MyMouse)
  479.         end
  480.     end
  481. end
  482.  
  483. end,o10)
  484. end))
  485. o11.Name = "Recoil"
  486. o11.Parent = o1
  487. o11.AnimationId = "http://www.roblox.com/Asset?ID=94331086"
  488. o12.Name = "WeaponHud"
  489. o12.Parent = o1
  490. o13.Name = "AmmoHud"
  491. o13.Parent = o12
  492. o13.Position = UDim2.new(1,-265,1,-60)
  493. o13.Size = UDim2.new(0,200,0,50)
  494. o13.Style = Enum.FrameStyle.RobloxSquare
  495. o13.Position = UDim2.new(1,-265,1,-60)
  496. o13.BackgroundTransparency = 1
  497. o13.BorderSizePixel = 0
  498. o14.Name = "ForwardSlash"
  499. o14.Parent = o13
  500. o14.Position = UDim2.new(0.5,0,0.5,0)
  501. o14.Text = "/"
  502. o14.Position = UDim2.new(0.5,0,0.5,0)
  503. o14.BackgroundTransparency = 1
  504. o14.BorderSizePixel = 0
  505. o14.FontSize = Enum.FontSize.Size24
  506. o14.TextColor3 = Color3.new(1, 1, 1)
  507. o14.TextStrokeTransparency = 0
  508. o15.Name = "ClipAmmo"
  509. o15.Parent = o13
  510. o15.Position = UDim2.new(0.44999998807907,0,0.5,0)
  511. o15.Text = "54"
  512. o15.Position = UDim2.new(0.44999998807907,0,0.5,0)
  513. o15.BackgroundTransparency = 1
  514. o15.BorderSizePixel = 0
  515. o15.FontSize = Enum.FontSize.Size24
  516. o15.TextColor3 = Color3.new(1, 1, 1)
  517. o15.TextStrokeTransparency = 0
  518. o15.TextXAlignment = Enum.TextXAlignment.Right
  519. o16.Name = "TotalAmmo"
  520. o16.Parent = o13
  521. o16.Position = UDim2.new(0.55000001192093,0,0.5,0)
  522. o16.Text = "180"
  523. o16.Position = UDim2.new(0.55000001192093,0,0.5,0)
  524. o16.BackgroundTransparency = 1
  525. o16.BorderSizePixel = 0
  526. o16.FontSize = Enum.FontSize.Size24
  527. o16.TextColor3 = Color3.new(1, 1, 1)
  528. o16.TextStrokeTransparency = 0
  529. o16.TextXAlignment = Enum.TextXAlignment.Left
  530. o17.Name = "Crosshair"
  531. o17.Parent = o12
  532. o17.Position = UDim2.new(0,500,0,500)
  533. o17.Size = UDim2.new(0,150,0,150)
  534. o17.Position = UDim2.new(0,500,0,500)
  535. o17.BackgroundColor3 = Color3.new(0, 1, 0)
  536. o17.BackgroundTransparency = 1
  537. o17.BorderSizePixel = 0
  538. o18.Name = "TopFrame"
  539. o18.Parent = o17
  540. o18.Position = UDim2.new(0,-1,-0.5,-7)
  541. o18.Size = UDim2.new(0,2,0,14)
  542. o18.Position = UDim2.new(0,-1,-0.5,-7)
  543. o18.BackgroundColor3 = Color3.new(1, 1, 1)
  544. o18.BorderColor3 = Color3.new(0, 0, 0)
  545. o19.Name = "RightFrame"
  546. o19.Parent = o17
  547. o19.Position = UDim2.new(0.5,-7,0,-1)
  548. o19.Size = UDim2.new(0,14,0,2)
  549. o19.Position = UDim2.new(0.5,-7,0,-1)
  550. o19.BackgroundColor3 = Color3.new(1, 1, 1)
  551. o19.BorderColor3 = Color3.new(0, 0, 0)
  552. o20.Name = "LeftFrame"
  553. o20.Parent = o17
  554. o20.Position = UDim2.new(-0.5,-7,0,-1)
  555. o20.Size = UDim2.new(0,14,0,2)
  556. o20.Position = UDim2.new(-0.5,-7,0,-1)
  557. o20.BackgroundColor3 = Color3.new(1, 1, 1)
  558. o20.BorderColor3 = Color3.new(0, 0, 0)
  559. o21.Name = "TargetHitImage"
  560. o21.Parent = o17
  561. o21.Position = UDim2.new(0,-25,0,-25)
  562. o21.Size = UDim2.new(0,50,0,50)
  563. o21.Position = UDim2.new(0,-25,0,-25)
  564. o21.Visible = false
  565. o21.BackgroundTransparency = 1
  566. o21.BorderSizePixel = 0
  567. o21.Image = "http://www.roblox.com/asset/?id=115400215"
  568. o22.Name = "ReloadingLabel"
  569. o22.Parent = o17
  570. o22.Position = UDim2.new(0,20,0,-20)
  571. o22.Text = "Reloading"
  572. o22.Position = UDim2.new(0,20,0,-20)
  573. o22.Visible = false
  574. o22.BackgroundTransparency = 1
  575. o22.BorderSizePixel = 0
  576. o22.Font = Enum.Font.ArialBold
  577. o22.FontSize = Enum.FontSize.Size18
  578. o22.TextColor3 = Color3.new(1, 1, 1)
  579. o22.TextStrokeTransparency = 0
  580. o22.TextXAlignment = Enum.TextXAlignment.Left
  581. o22.TextYAlignment = Enum.TextYAlignment.Bottom
  582. o23.Name = "BottomFrame"
  583. o23.Parent = o17
  584. o23.Position = UDim2.new(0,-1,0.5,-7)
  585. o23.Size = UDim2.new(0,2,0,14)
  586. o23.Position = UDim2.new(0,-1,0.5,-7)
  587. o23.BackgroundColor3 = Color3.new(1, 1, 1)
  588. o23.BorderColor3 = Color3.new(0, 0, 0)
  589. o24.Name = "Reload"
  590. o24.Parent = o12
  591. o24.Position = UDim2.new(1,-265,1,-120)
  592. o24.Size = UDim2.new(0,200,0,50)
  593. o24.Position = UDim2.new(1,-265,1,-120)
  594. o24.Visible = false
  595. o24.BackgroundTransparency = 1
  596. o24.BorderSizePixel = 0
  597. o25.Name = "Reload"
  598. o25.Parent = o24
  599. o25.Position = UDim2.new(0.5,0,0.5,0)
  600. o25.Text = "Press R to Reload"
  601. o25.Position = UDim2.new(0.5,0,0.5,0)
  602. o25.BackgroundTransparency = 1
  603. o25.BorderSizePixel = 0
  604. o25.Font = Enum.Font.ArialBold
  605. o25.FontSize = Enum.FontSize.Size24
  606. o25.TextColor3 = Color3.new(1, 0, 0)
  607. o25.TextStrokeTransparency = 0
  608. o26.Name = "ArmWeld [Rifle]"
  609. o26.Parent = o1
  610. table.insert(cors,coroutine.create(function()
  611. wait()
  612. runDummyScript(function()
  613. Tool = script.Parent;
  614.  
  615. local arms = nil
  616. local torso = nil
  617. local welds = {}
  618.  
  619. function Equip(mouse)
  620. wait(0.01)
  621. arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
  622. torso = Tool.Parent:FindFirstChild("Torso")
  623. if arms ~= nil and torso ~= nil then
  624. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  625. if sh ~= nil then
  626. local yes = true
  627. if yes then
  628. yes = false
  629. sh[1].Part1 = nil
  630. sh[2].Part1 = nil
  631. local weld1 = Instance.new("Weld")
  632. weld1.Part0 = torso
  633. weld1.Parent = torso
  634. weld1.Part1 = arms[1]
  635. 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
  636. welds[1] = weld1
  637. weld1.Name = "weld1"
  638. local weld2 = Instance.new("Weld")
  639. weld2.Part0 = torso
  640. weld2.Parent = torso
  641. weld2.Part1 = arms[2]
  642. weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0) --- Same as top
  643. welds[2] = weld2
  644. weld2.Name = "weld2"
  645. end
  646. else
  647. print("sh")
  648. end
  649. else
  650. print("arms")
  651. end
  652. end
  653.  
  654. function Unequip(mouse)
  655. if arms ~= nil and torso ~= nil then
  656. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  657. if sh ~= nil then
  658. local yes = true
  659. if yes then
  660. yes = false
  661. sh[1].Part1 = arms[1]
  662. sh[2].Part1 = arms[2]
  663. welds[1].Parent = nil
  664. welds[2].Parent = nil
  665. end
  666. else
  667. print("sh")
  668. end
  669. else
  670. print("arms")
  671. end
  672. end
  673. Tool.Equipped:connect(Equip)
  674. Tool.Unequipped:connect(Unequip)
  675.  
  676. end,o26)
  677. end))
  678. mas.Parent = workspace
  679. mas:MakeJoints()
  680. local mas1 = mas:GetChildren()
  681. for i=1,#mas1 do
  682.     mas1[i].Parent = workspace
  683.     ypcall(function() mas1[i]:MakeJoints() end)
  684. end
  685. mas:Destroy()
  686. for i=1,#cors do
  687. coroutine.resume(cors[i])
  688. end
Add Comment
Please, Sign In to add comment