Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- This script was made by N0OT_NOOT123
- wait(2)
- -- Tables
- local GunSettings = {
- Ammo = 16,
- Automatic = true,
- Damage = math.random(4,7),
- ExplosiveAmmo = false,
- ReloadTime = 2,
- Debounce = 0.2
- }
- local GunAnimations = {
- Reload = "",
- Fire = "",
- Hold = "",
- Walk = "",
- Run = "",
- Aim = ""
- }
- local RemoteEvents = {
- Fire = game.ReplicatedStorage.FireGun,
- Reload = game.ReplicatedStorage.Reload,
- Sound = game.ReplicatedStorage.PlaySound
- }
- -- Variables
- local Player = game.Players.LocalPlayer
- local Character = Player.Character
- local UserInputService = game:GetService("UserInputService")
- local Mouse = Player:GetMouse()
- local Reloading = false
- local ShootingAutomatic = false
- local Debounce = false
- -- Functions
- local function CreateAnim(ID)
- local Anim = Instance.new("Animation",script)
- Anim.AnimationId = ID
- game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
- end
- -- Reloading
- UserInputService.InputBegan:Connect(function(KeyDown)
- if KeyDown.KeyCode == Enum.KeyCode.R then
- Reloading = true
- wait(GunSettings.ReloadTime)
- RemoteEvents.Reload:FireServer(GunSettings.Ammo, GunSettings.ReloadTime)
- Reloading = false
- end
- end)
- -- Fire
- Mouse.Button1Down:Connect(function()
- wait(0.01)
- if GunSettings.Automatic == true then
- ShootingAutomatic = true
- while ShootingAutomatic == true do
- if Debounce == false then
- Debounce = true
- wait(GunSettings.Debounce)
- warn("Shot")
- --RemoteEvents.Fire:FireServer()
- Debounce = false
- else
- end
- end
- else
- if Debounce == false then
- Debounce = true
- wait(GunSettings.Debounce)
- --RemoteEvents.Fire:FireServer()
- Debounce = false
- else
- end
- end
- end)
- Mouse.Button1Up:Connect(function()
- if ShootingAutomatic == true then
- ShootingAutomatic = false
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement