Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- game.Players.LocalPlayer.Backpack.Deagle.PistolScript:Destroy()
- wait()
- local script = Instance.new("LocalScript")
- script.Name = "PistolScript"
- script.Parent = game.Players.LocalPlayer.Backpack.Deagle
- --//internals\\--
- local Player = game.Players.LocalPlayer
- repeat
- wait()
- until Player.Character ~= nil
- repeat
- wait()
- until Player:findFirstChild("PlayerGui") ~= nil
- local IS = game:GetService("UserInputService")
- local Camera = workspace.CurrentCamera
- local Mouse = Player:GetMouse()
- local Char = Player.Character
- local Torso = Char:WaitForChild("UpperTorso")
- local Humanoid = Char:WaitForChild("Humanoid")
- local Handle = script.Parent:WaitForChild("Handle")
- local RecoilAmount = Player.PlayerScripts:WaitForChild("Client"):WaitForChild("Recoil")
- local Modules = game.ReplicatedStorage:WaitForChild("Modules")
- local WC = require(Modules:WaitForChild("WeaponCore"))
- local Aiming = Char:WaitForChild("Aiming")
- local WeaponHUD = Player.PlayerGui:WaitForChild("MainGUI"):WaitForChild("StatsHUD"):WaitForChild("WeaponHUD")
- local Crosshair = Player.PlayerGui:WaitForChild("CrosshairGUI"):WaitForChild("Center")
- local MouseDown = false
- local Mobile = false
- local ShootButton
- if IS.TouchEnabled then
- Mobile = true
- ShootButton = Player.PlayerGui:WaitForChild("TouchGui"):WaitForChild("TouchControlFrame"):WaitForChild("ShootButton")
- ShootButton.Changed:connect(function()
- if ShootButton.Image == "rbxassetid://2568914327" then
- MouseDown = true
- else
- MouseDown = false
- end
- end)
- end
- local Db = false
- local Reloading = false
- local Equipped
- local Ammo = math.huge
- local FireRate = 0
- local Damage = 100
- local Spread = 1
- local Recoil = 0
- local Clip = Ammo
- local Handle = script.Parent:WaitForChild("Handle")
- local GunName = script.Parent.Name
- local Anims = {}
- function StopAnimations()
- for _, v in ipairs(Anims) do
- if Anims ~= nil then
- v:Stop()
- end
- end
- Anims = {}
- end
- function LoadAnimation(id)
- local animation = Instance.new("Animation", Humanoid)
- animation.AnimationId = "http://www.roblox.com/Asset?ID=" .. id
- local animTrack = Humanoid:LoadAnimation(animation)
- animTrack:Play()
- animTrack:Stop()
- end
- function PlayAnimation(id, t)
- local animation = Instance.new("Animation", Humanoid)
- animation.AnimationId = "http://www.roblox.com/Asset?ID=" .. id
- local animTrack = Humanoid:LoadAnimation(animation)
- animTrack:Play()
- table.insert(Anims, animTrack)
- local finished = false
- animTrack.Stopped:connect(function()
- finished = true
- end)
- repeat
- wait()
- until finished
- animTrack = nil
- animation:Destroy()
- end
- local GetSkin = game.ReplicatedStorage.RemoteFunction:InvokeServer("GetSkin", script.Parent.Name)
- if GetSkin then
- else
- print("Failed to get skin [" .. script.Parent.Name .. "]")
- end
- LoadAnimation(1233834240)
- LoadAnimation(1233836139)
- LoadAnimation(1234743288)
- LoadAnimation(1241157703)
- LoadAnimation(1241010205)
- function Reload()
- if Equipped and not Db and Ammo ~= Clip and not Reloading and Humanoid.Health > 0 then
- Reloading = true
- WC.PlaySound(Char, 174295321, Torso)
- WC.MagReload(Char, Handle)
- spawn(function()
- wait(1.2)
- WC.PlaySound(Char, 506273075, Torso)
- end)
- PlayAnimation(1241157703)
- Ammo = Clip
- WeaponHUD.Ammo.Ammo1.Text = Ammo
- WeaponHUD.Ammo.Ammo2.Text = Clip
- wait(0.1)
- Reloading = false
- end
- end
- function GetMousePoint(X, Y)
- local ignore = {
- workspace.Ignore,
- Char,
- workspace.Water
- }
- local Mag = Camera:ScreenPointToRay(X, Y)
- local NewRay = Ray.new(Mag.Origin, Mag.Direction * 2000)
- local Target, Position = workspace:FindPartOnRayWithIgnoreList(NewRay, ignore, false, true)
- return Position
- end
- function RayCheck()
- local ignore = {
- workspace.Ignore,
- Char,
- workspace.Water
- }
- local Pos = Handle.CFrame * CFrame.new(0, 0.25, 1.5)
- local ray = Ray.new(Pos.p, (Mouse.Hit.p - Pos.p).unit * 2.5)
- local part, position = workspace:FindPartOnRayWithIgnoreList(ray, ignore, false, true)
- if part then
- return false
- else
- return true
- end
- end
- if not Mobile then
- IS.InputBegan:connect(function(input, chatting)
- if Equipped then
- if input.UserInputType == Enum.UserInputType.Keyboard and not chatting and input.KeyCode == Enum.KeyCode.R then
- Reload()
- end
- if input.UserInputType == Enum.UserInputType.Touch and not chatting and input.Key then
- Reload()
- end
- if input.UserInputType == Enum.UserInputType.Gamepad1 then
- if input.KeyCode == Enum.KeyCode.ButtonX then
- Reload()
- end
- if input.KeyCode == Enum.KeyCode.ButtonR2 and Equipped and not Reloading and not Db then
- MouseDown = true
- Running = false
- end
- end
- end
- end)
- IS.InputEnded:connect(function(input, chatting)
- if input.UserInputType == Enum.UserInputType.Keyboard then
- end
- if input.UserInputType == Enum.UserInputType.Gamepad1 and input.KeyCode == Enum.KeyCode.ButtonR2 then
- MouseDown = false
- Running = false
- end
- end)
- Mouse.Button1Down:connect(function()
- if Equipped and not Reloading and not Db then
- MouseDown = true
- Running = false
- end
- end)
- Mouse.Button1Up:connect(function()
- if Equipped and not Db then
- Db = true
- MouseDown = false
- Db = false
- end
- end)
- end
- spawn(function()
- while true do
- while true do
- wait(FireRate)
- if MouseDown and not Reloading and Equipped and not Running and Humanoid.Health > 0 and Aiming.Value and RayCheck() then
- if Ammo > 0 then
- RecoilAmount.Value = Vector3.new(math.random(-Recoil, Recoil) / 100, Recoil / 100, math.random(-Recoil, Recoil) / 100)
- Ammo = Ammo - 1
- WeaponHUD.Ammo.Ammo1.Text = Ammo
- WeaponHUD.Ammo.Ammo2.Text = Clip
- WC.PlaySound(Char, 1772743949, Torso)
- WC.ShootGun(Char, Char, GetMousePoint(Crosshair.AbsolutePosition.X, Crosshair.AbsolutePosition.Y), GunName, Damage, Spread)
- spawn(function()
- PlayAnimation(1241010205, true)
- end)
- end
- end
- end
- Reload()
- end
- end)
- script.Parent.Equipped:connect(function()
- if ShootButton then
- ShootButton.Visible = true
- end
- WeaponHUD.Visible = true
- WeaponHUD.Weapon.Icon.Image = script.Parent.TextureId
- WeaponHUD.Ammo.TextLabel.Text = script.Parent.Name
- WeaponHUD.Ammo.Ammo1.Text = Ammo
- WeaponHUD.Ammo.Ammo2.Text = Clip
- WeaponHUD.Ammo.Slash.Visible = true
- WC.Equip(Char, Char, Handle)
- WC.PlaySound(Char, 153647514, Torso)
- Mouse.TargetFilter = workspace.Ignore
- PlayAnimation(1233834240)
- if Char:findFirstChild(GunName) then
- Equipped = true
- PlayAnimation(1240868684)
- end
- end)
- script.Parent.Unequipped:connect(function()
- if ShootButton then
- ShootButton.Visible = false
- end
- MouseDown = false
- WeaponHUD.Visible = false
- StopAnimations()
- Equipped = false
- WC.PlaySound(Char, 153647514, Torso)
- if not Char:findFirstChild("Crawling") then
- PlayAnimation(1233836139, true)
- end
- StopAnimations()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement