Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. -- This script was made by N0OT_NOOT123
  2. wait(2)
  3.  
  4. -- Tables
  5. local GunSettings = {
  6. Ammo = 16,
  7. Automatic = true,
  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.  
  73. end
  74. end
  75. else
  76. if Debounce == false then
  77. Debounce = true
  78. wait(GunSettings.Debounce)
  79. --RemoteEvents.Fire:FireServer()
  80. Debounce = false
  81. else
  82.  
  83. end
  84. end
  85. end)
  86.  
  87.  
  88. Mouse.Button1Up:Connect(function()
  89. if ShootingAutomatic == true then
  90. ShootingAutomatic = false
  91. end
  92. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement