Can someone please help me

I don’t know what I am doing wrong but every single time I have tried to script something I always get an error and some the colors of the text does not show up the same as the tutorials I am following.
I am getting “error CS1002: ; expected” with this script

using System.Collections;
using UnityEngine;

public class Guncontroller : MonoBehaviour
{
    [header("Gun Settings")]
    public float fireRate = 0.1f;
    public int clipSize = 30;
    public int reservedAmmoCapacity = 270;

    //Variables that change throughout the code
    bool _canShoot;
    int _currentAmmoInClip
    int _ammoInReserve;

    private void Start()
    {
        _currentAmmoInClip = clipSize;
        _ammoInReserve = reservedAmmoCapacity;
        _canShoot = true;
    }

    private void update()
    {
        if(input.GetMouseButton(0) && _canShoot && _currentAmmoInClip > 0)
        {
            _canShoot = false;
            _currentAmmoInClip--;
            StartCoroutine(ShootGun());
        }
    }

    IEnumerator ShootGun()
    {
        yield return new WaitForSeconds(fireRate);
        _canShoot;
    }
}

Line 13 is missing a semi colon at the end.

Next time you post, it’d be easier if you would copy/paste the whole error. It makes it easier to figure out what’s wrong as it includes the line number :wink:

Edit - also on 23, update should be Update, otherwise it won’t run every frame as I think you intended.

Sorry about that lol, There is another error now
Assets\Guncontroller.cs(25,12): error CS0103: The name ‘input’ does not exist in the current context
Edit wait never mind I didn’t have a capital I
Now I got
Assets\Guncontroller.cs(36,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
Nvm fixed it again, man I am getting good at this whole fixing my mistakes thing

1 Like

A very good sign :sunglasses: