SHARE
TWEET

yeet

a guest Jun 16th, 2019 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. game.Players.LocalPlayer.Backpack.Deagle.PistolScript:Destroy()
  2. wait()
  3. local script = Instance.new("LocalScript")
  4. script.Name = "PistolScript"
  5. script.Parent = game.Players.LocalPlayer.Backpack.Deagle
  6.  
  7. --//internals\\--
  8.  
  9. local Player = game.Players.LocalPlayer
  10. repeat
  11.     wait()
  12. until Player.Character ~= nil
  13. repeat
  14.     wait()
  15. until Player:findFirstChild("PlayerGui") ~= nil
  16. local IS = game:GetService("UserInputService")
  17. local Camera = workspace.CurrentCamera
  18. local Mouse = Player:GetMouse()
  19. local Char = Player.Character
  20. local Torso = Char:WaitForChild("UpperTorso")
  21. local Humanoid = Char:WaitForChild("Humanoid")
  22. local Handle = script.Parent:WaitForChild("Handle")
  23. local RecoilAmount = Player.PlayerScripts:WaitForChild("Client"):WaitForChild("Recoil")
  24. local Modules = game.ReplicatedStorage:WaitForChild("Modules")
  25. local WC = require(Modules:WaitForChild("WeaponCore"))
  26. local Aiming = Char:WaitForChild("Aiming")
  27. local WeaponHUD = Player.PlayerGui:WaitForChild("MainGUI"):WaitForChild("StatsHUD"):WaitForChild("WeaponHUD")
  28. local Crosshair = Player.PlayerGui:WaitForChild("CrosshairGUI"):WaitForChild("Center")
  29. local MouseDown = false
  30. local Mobile = false
  31. local ShootButton
  32. if IS.TouchEnabled then
  33.     Mobile = true
  34.     ShootButton = Player.PlayerGui:WaitForChild("TouchGui"):WaitForChild("TouchControlFrame"):WaitForChild("ShootButton")
  35.     ShootButton.Changed:connect(function()
  36.         if ShootButton.Image == "rbxassetid://2568914327" then
  37.             MouseDown = true
  38.         else
  39.             MouseDown = false
  40.         end
  41.     end)
  42. end
  43. local Db = false
  44. local Reloading = false
  45. local Equipped
  46. local Ammo = math.huge
  47. local FireRate = 0
  48. local Damage = 100
  49. local Spread = 1
  50. local Recoil = 0
  51. local Clip = Ammo
  52. local Handle = script.Parent:WaitForChild("Handle")
  53. local GunName = script.Parent.Name
  54. local Anims = {}
  55. function StopAnimations()
  56.     for _, v in ipairs(Anims) do
  57.         if Anims ~= nil then
  58.             v:Stop()
  59.         end
  60.     end
  61.     Anims = {}
  62. end
  63. function LoadAnimation(id)
  64.     local animation = Instance.new("Animation", Humanoid)
  65.     animation.AnimationId = "http://www.roblox.com/Asset?ID=" .. id
  66.     local animTrack = Humanoid:LoadAnimation(animation)
  67.     animTrack:Play()
  68.     animTrack:Stop()
  69. end
  70. function PlayAnimation(id, t)
  71.     local animation = Instance.new("Animation", Humanoid)
  72.     animation.AnimationId = "http://www.roblox.com/Asset?ID=" .. id
  73.     local animTrack = Humanoid:LoadAnimation(animation)
  74.     animTrack:Play()
  75.     table.insert(Anims, animTrack)
  76.     local finished = false
  77.     animTrack.Stopped:connect(function()
  78.         finished = true
  79.     end)
  80.     repeat
  81.         wait()
  82.     until finished
  83.     animTrack = nil
  84.     animation:Destroy()
  85. end
  86. local GetSkin = game.ReplicatedStorage.RemoteFunction:InvokeServer("GetSkin", script.Parent.Name)
  87. if GetSkin then
  88. else
  89.     print("Failed to get skin [" .. script.Parent.Name .. "]")
  90. end
  91. LoadAnimation(1233834240)
  92. LoadAnimation(1233836139)
  93. LoadAnimation(1234743288)
  94. LoadAnimation(1241157703)
  95. LoadAnimation(1241010205)
  96. function Reload()
  97.     if Equipped and not Db and Ammo ~= Clip and not Reloading and Humanoid.Health > 0 then
  98.         Reloading = true
  99.         WC.PlaySound(Char, 174295321, Torso)
  100.         WC.MagReload(Char, Handle)
  101.         spawn(function()
  102.             wait(1.2)
  103.             WC.PlaySound(Char, 506273075, Torso)
  104.         end)
  105.         PlayAnimation(1241157703)
  106.         Ammo = Clip
  107.         WeaponHUD.Ammo.Ammo1.Text = Ammo
  108.         WeaponHUD.Ammo.Ammo2.Text = Clip
  109.         wait(0.1)
  110.         Reloading = false
  111.     end
  112. end
  113. function GetMousePoint(X, Y)
  114.     local ignore = {
  115.         workspace.Ignore,
  116.         Char,
  117.         workspace.Water
  118.     }
  119.     local Mag = Camera:ScreenPointToRay(X, Y)
  120.     local NewRay = Ray.new(Mag.Origin, Mag.Direction * 2000)
  121.     local Target, Position = workspace:FindPartOnRayWithIgnoreList(NewRay, ignore, false, true)
  122.     return Position
  123. end
  124. function RayCheck()
  125.     local ignore = {
  126.         workspace.Ignore,
  127.         Char,
  128.         workspace.Water
  129.     }
  130.     local Pos = Handle.CFrame * CFrame.new(0, 0.25, 1.5)
  131.     local ray = Ray.new(Pos.p, (Mouse.Hit.p - Pos.p).unit * 2.5)
  132.     local part, position = workspace:FindPartOnRayWithIgnoreList(ray, ignore, false, true)
  133.     if part then
  134.         return false
  135.     else
  136.         return true
  137.     end
  138. end
  139. if not Mobile then
  140.     IS.InputBegan:connect(function(input, chatting)
  141.         if Equipped then
  142.             if input.UserInputType == Enum.UserInputType.Keyboard and not chatting and input.KeyCode == Enum.KeyCode.R then
  143.                 Reload()
  144.             end
  145.             if input.UserInputType == Enum.UserInputType.Touch and not chatting and input.Key then
  146.                 Reload()
  147.             end
  148.             if input.UserInputType == Enum.UserInputType.Gamepad1 then
  149.                 if input.KeyCode == Enum.KeyCode.ButtonX then
  150.                     Reload()
  151.                 end
  152.                 if input.KeyCode == Enum.KeyCode.ButtonR2 and Equipped and not Reloading and not Db then
  153.                     MouseDown = true
  154.                     Running = false
  155.                 end
  156.             end
  157.         end
  158.     end)
  159.     IS.InputEnded:connect(function(input, chatting)
  160.         if input.UserInputType == Enum.UserInputType.Keyboard then
  161.         end
  162.         if input.UserInputType == Enum.UserInputType.Gamepad1 and input.KeyCode == Enum.KeyCode.ButtonR2 then
  163.             MouseDown = false
  164.             Running = false
  165.         end
  166.     end)
  167.     Mouse.Button1Down:connect(function()
  168.         if Equipped and not Reloading and not Db then
  169.             MouseDown = true
  170.             Running = false
  171.         end
  172.     end)
  173.     Mouse.Button1Up:connect(function()
  174.         if Equipped and not Db then
  175.             Db = true
  176.             MouseDown = false
  177.             Db = false
  178.         end
  179.     end)
  180. end
  181. spawn(function()
  182.     while true do
  183.         while true do
  184.             wait(FireRate)
  185.             if MouseDown and not Reloading and Equipped and not Running and Humanoid.Health > 0 and Aiming.Value and RayCheck() then
  186.                 if Ammo > 0 then
  187.                     RecoilAmount.Value = Vector3.new(math.random(-Recoil, Recoil) / 100, Recoil / 100, math.random(-Recoil, Recoil) / 100)
  188.                     Ammo = Ammo - 1
  189.                     WeaponHUD.Ammo.Ammo1.Text = Ammo
  190.                     WeaponHUD.Ammo.Ammo2.Text = Clip
  191.                     WC.PlaySound(Char, 1772743949, Torso)
  192.                     WC.ShootGun(Char, Char, GetMousePoint(Crosshair.AbsolutePosition.X, Crosshair.AbsolutePosition.Y), GunName, Damage, Spread)
  193.                     spawn(function()
  194.                         PlayAnimation(1241010205, true)
  195.                     end)
  196.                 end
  197.             end
  198.         end
  199.         Reload()
  200.     end
  201. end)
  202. script.Parent.Equipped:connect(function()
  203.     if ShootButton then
  204.         ShootButton.Visible = true
  205.     end
  206.     WeaponHUD.Visible = true
  207.     WeaponHUD.Weapon.Icon.Image = script.Parent.TextureId
  208.     WeaponHUD.Ammo.TextLabel.Text = script.Parent.Name
  209.     WeaponHUD.Ammo.Ammo1.Text = Ammo
  210.     WeaponHUD.Ammo.Ammo2.Text = Clip
  211.     WeaponHUD.Ammo.Slash.Visible = true
  212.     WC.Equip(Char, Char, Handle)
  213.     WC.PlaySound(Char, 153647514, Torso)
  214.     Mouse.TargetFilter = workspace.Ignore
  215.     PlayAnimation(1233834240)
  216.     if Char:findFirstChild(GunName) then
  217.         Equipped = true
  218.         PlayAnimation(1240868684)
  219.     end
  220. end)
  221. script.Parent.Unequipped:connect(function()
  222.     if ShootButton then
  223.         ShootButton.Visible = false
  224.     end
  225.     MouseDown = false
  226.     WeaponHUD.Visible = false
  227.     StopAnimations()
  228.     Equipped = false
  229.     WC.PlaySound(Char, 153647514, Torso)
  230.     if not Char:findFirstChild("Crawling") then
  231.         PlayAnimation(1233836139, true)
  232.     end
  233.     StopAnimations()
  234. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top