SHARE
TWEET

Untitled

a guest Aug 17th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- This script was made by N0OT_NOOT123
  2. wait(2)
  3.  
  4. -- Tables
  5. local GunSettings = {
  6.     Ammo = 16,
  7.     Automatic = false,
  8.     Damage = math.random(4,7),
  9.     ExplosiveAmmo = false,
  10.     ReloadTime = 2,
  11.     Debounce = 0.2
  12. }
  13.  
  14. local GunAnimations = {
  15.     Reload = "",
  16.     Fire = "",
  17.     Hold = "",
  18.     Walk = "",
  19.     Run = "",
  20.     Aim = ""
  21. }
  22.  
  23. local RemoteEvents = {
  24.     Fire = game.ReplicatedStorage.FireGun,
  25.     Reload = game.ReplicatedStorage.Reload,
  26.     Sound = game.ReplicatedStorage.PlaySound
  27.     }
  28.  
  29. -- Variables
  30.  
  31. local Player = game.Players.LocalPlayer
  32. local Character = Player.Character
  33. local UserInputService = game:GetService("UserInputService")
  34. local Mouse = Player:GetMouse()
  35. local Reloading = false
  36. local ShootingAutomatic = false
  37. local Debounce = false
  38.  
  39. -- Functions
  40.  
  41. local function CreateAnim(ID)
  42.     local Anim = Instance.new("Animation",script)
  43.     Anim.AnimationId = ID
  44.     game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
  45. end
  46.  
  47. -- Reloading
  48.  
  49. UserInputService.InputBegan:Connect(function(KeyDown)
  50.     if KeyDown.KeyCode == Enum.KeyCode.R then
  51.         Reloading = true
  52.         wait(GunSettings.ReloadTime)
  53.         RemoteEvents.Reload:FireServer(GunSettings.Ammo, GunSettings.ReloadTime)
  54.         Reloading = false
  55.     end
  56. end)
  57.  
  58. -- Fire
  59.  
  60. Mouse.Button1Down:Connect(function()
  61.     wait(0.01)
  62.     if GunSettings.Automatic == true then
  63.         ShootingAutomatic = true
  64.         while ShootingAutomatic == true do
  65.             if Debounce == false then
  66.                 Debounce = true
  67.             wait(GunSettings.Debounce)
  68.             warn("Shot")
  69.             --RemoteEvents.Fire:FireServer()
  70.             Debounce = false
  71.             else
  72.                 break
  73.             end
  74.         end
  75.     else
  76.         if Debounce == false then
  77.             Debounce = true
  78.             wait(GunSettings.Debounce)
  79.             warn("Shot")
  80.             --RemoteEvents.Fire:FireServer()
  81.             Debounce = false
  82.         else
  83.            
  84.         end
  85.     end
  86. end)
  87.  
  88.  
  89. Mouse.Button1Up:Connect(function()
  90.     if ShootingAutomatic == true then
  91.         ShootingAutomatic = false
  92.     end
  93. 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