so far i’m making a fps game with a friend just for fun and my friend made a revolver first… i put in the script “Getbuttondown” which makes it shoot with every click rather than holding it down…
But my friend made a thompson and whenever i switch guns the thompson stays single shot as its following the script…
how can i change the script so it can recognize that the thompson needs to be “Getbutton” and the revolver to stay as “Getbuttondown”?
i thought it could be something with tags but i don’t how to add it to the script and make it work…
this is just a piece of the code from my script… sorry if it seems messy but im an amateur
thanks in advance
if (Input.GetButtonDown("Fire1"))
{
if (waitTilNextFire <= 0)
{
if (bullet)
Instantiate(bullet,bulletspawn.transform.position, bulletspawn.transform.rotation);
if (bulletSound)
holdSound = Instantiate(bulletSound,bulletspawn.transform.position, bulletspawn.transform.rotation);
if (muzzleFlash)
holdmuzzleFlash = Instantiate(muzzleFlash,bulletspawn.transform.position, bulletspawn.transform.rotation);
targetXRotation += (Random.value - 0.5) * Mathf.Lerp(shootAngleRandomizationAiming, shootAngleRandomizationNotAiming, ratioHipHold);
targetYRotation += (Random.value - 0.5) * Mathf.Lerp(shootAngleRandomizationAiming, shootAngleRandomizationNotAiming, ratioHipHold);
currentRecoilZPos -= recoilAmount;
waitTilNextFire = 6;
}
}