Advertisement
HowTEYT

Untitled

Oct 18th, 2020
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.51 KB | None | 0 0
  1. local Player = game.Players.LocalPlayer
  2. local Character = Player.Character or Player.CharacterAdded:Wait()
  3. local Humanoid = Character:WaitForChild("Humanoid")
  4. local root = Character:WaitForChild("HumanoidRootPart")
  5. local Input = game:GetService("UserInputService")
  6. local gui = script.Parent:WaitForChild("GunGui")
  7. local debounce = true
  8. local shooterName
  9.  
  10. while Character.Parent == nil do
  11. Character.AncestryChanged:wait()
  12. end
  13.  
  14. if Character:FindFirstChild("Humanoid") then
  15. local animation = Humanoid:LoadAnimation(script:WaitForChild("NormalAnim"))
  16. local sprintAnimation = Humanoid:LoadAnimation(script:WaitForChild("RunAnim"))
  17. local reloadAnimation = Humanoid:LoadAnimation(script:WaitForChild("ReloadAnim"))
  18.  
  19. script.Parent.Equipped:connect(function()
  20. if Character:FindFirstChild("Humanoid") then
  21. animation = Humanoid:LoadAnimation(script:WaitForChild("NormalAnim"))
  22. sprintAnimation = Humanoid:LoadAnimation(script:WaitForChild("RunAnim"))
  23. reloadAnimation = Humanoid:LoadAnimation(script:WaitForChild("ReloadAnim"))
  24. script.Parent.Select:Play()
  25. animation:Play()
  26. sprintAnimation:Stop()
  27. script.Parent.RTShoot.Value = true
  28. script.Parent.Sprinting.Value = false
  29. script.Parent.IsEquipped.Value = true
  30. end
  31. end)
  32.  
  33. script.Parent.Unequipped:connect(function()
  34. if Character:FindFirstChild("Humanoid") then
  35. script.Parent.Empty:Play()
  36. animation:Stop()
  37. sprintAnimation:Stop()
  38. script.Parent.RTShoot.Value = true
  39. script.Parent.Sprinting.Value = false
  40. script.Parent.IsEquipped.Value = false
  41. Humanoid.WalkSpeed = 16
  42. end
  43. end)
  44.  
  45. script.Parent.Activated:connect(function()
  46. if script.Parent.Rounds.Value >= 1 then else return end
  47. if script.Parent.Reloading.Value == true then return end
  48.  
  49. local shooterName = Player.Name
  50. if debounce == true then
  51. if script.Parent.Sprinting.Value == false then
  52. debounce = false
  53. script.Parent.Rounds.Value = script.Parent.Rounds.Value - 1
  54. script.Parent.ShootEvent:FireServer(Player:GetMouse().Hit.LookVector, shooterName)
  55. wait(.25)
  56. Character:WaitForChild("Humanoid").WalkSpeed = 16
  57. debounce = true
  58. end
  59. end
  60. end)
  61.  
  62. Input.InputBegan:Connect(function(Key,GameProcessed)
  63. if GameProcessed then return end
  64.  
  65. if Character:FindFirstChild("Humanoid") then
  66. if Key.KeyCode == Enum.KeyCode.R then
  67. if script.Parent.Rounds.Value <= 12 then
  68. if script.Parent.IsEquipped.Value == true then
  69. if script.Parent.Reloading.Value == false then
  70. script.Parent.Reloading.Value = true
  71. animation:Stop()
  72. sprintAnimation:Stop()
  73. reloadAnimation:Play()
  74. wait(2)
  75. animation:Play()
  76. reloadAnimation:Stop()
  77. script.Parent.Reloading.Value = false
  78. script.Parent.Rounds.Value = 13
  79. end
  80. end
  81. end
  82. elseif Key.KeyCode == Enum.KeyCode.LeftShift then
  83. if script.Parent.IsEquipped.Value == true then
  84. if script.Parent.RTShoot.Value == true and script.Parent.Reloading.Value == false and script.Parent.Sprinting.Value == false then
  85. animation:Stop()
  86. sprintAnimation:Play()
  87. script.Parent.RTShoot.Value = false
  88. script.Parent.Sprinting.Value = true
  89. Humanoid.WalkSpeed = 32
  90. else
  91. animation:Play()
  92. sprintAnimation:Stop()
  93. script.Parent.RTShoot.Value = true
  94. script.Parent.Sprinting.Value = false
  95. Humanoid.WalkSpeed = 16
  96. end
  97. end
  98. end
  99. end
  100. end)
  101.  
  102. while wait() do
  103. game:GetService("ServerStorage"):WaitForChild("ShooterName").Value = shooterName
  104. end
  105. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement