How Do I Make An AmmoPick Up Whats Wrong With This

public class Destroy : MonoBehaviour
{
public float pistolAmmo;
public float arAmmo;
public float shotgunAmmo;

public void OnTriggerEnter(Collision collision)
{
if (collision.transform.tag == “Player”)
{

RaycastHit hit;
if (Physics.Raycast(this.transform.position, this.transform.forward, out hit))
{
PlayerShoot PShoot = hit.transform.GetComponentInChildren();
if (PShoot != null)
{
PShoot.PistolAmmoPickUp(pistolAmmo);
Destroy(gameObject);
}
}
}
if (collision.transform.tag == “Player”)
{

RaycastHit hit;
if (Physics.Raycast(this.transform.position, this.transform.forward, out hit))
{
PlayerShoot PShoot = hit.transform.GetComponentInChildren();
if (PShoot != null)
{
PShoot.ShotgunAmmoPickUp(shotgunAmmo);
Destroy(gameObject);
}
}
}
if (collision.transform.tag == “Player”)
{

RaycastHit hit;
if (Physics.Raycast(this.transform.position, this.transform.forward, out hit))
{
PlayerShoot PShoot = hit.transform.GetComponentInChildren();
if (PShoot != null)
{
PShoot.ArAmmoPickUp(arAmmo);
Destroy(gameObject);
}
}
}
}

}

using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;

public class PlayerShoot : MonoBehaviour
{
public float damage = 12;
public float range = 75;
public float fireRate;

public float allAmmo;
public int maxAmmo;
private int currentAmmo;
public float reloadTime;
private bool isReloading = false;
private bool canReload = true;

public Camera fpsCam;
private float nextTimeToFire = 0f;
public bool Automatic;

public Animator animator;
public ParticleSystem Bullet;

private bool canShoot;
public Text gunText;

public float ArAmmo;
public float ShotgunAmmo;
public float PistolAmmo;

public bool isPistol;
public bool isAr;
public bool isShotgun;

public void Start()
{
currentAmmo = maxAmmo;
canShoot = true;
}
void Update()
{
gunText.text = currentAmmo.ToString() + " / " + allAmmo.ToString();

if (isReloading && canShoot)
return;

if(allAmmo <= 0) {
canReload = false;
allAmmo = 0;
}
if (Input.GetKey(KeyCode.LeftControl))
{
canShoot = false;
}
else
{
canShoot = true;
}
if (allAmmo <= maxAmmo && currentAmmo <= 0)
{

canShoot = false;

}

if (Input.GetKeyDown(KeyCode.R) && canReload)
{
StartCoroutine(Reload());
return;
}

if(currentAmmo <= 0 && canReload )
{
StartCoroutine(Reload());
return;
}
if (Input.GetButtonDown(“Fire1”) && Time.time >= nextTimeToFire && !Automatic && canShoot)
{
nextTimeToFire = Time.time + 1f / fireRate;
Shoot();
}
if (Input.GetButton(“Fire1”) && Time.time >= nextTimeToFire && Automatic && canShoot)
{
nextTimeToFire = Time.time + 1f / fireRate;
Shoot();
}

}

IEnumerator Reload()
{

allAmmo -= maxAmmo - currentAmmo;
isReloading = true;
animator.SetBool(“Reloading”, true);
yield return new WaitForSeconds(reloadTime);

currentAmmo = maxAmmo;

isReloading = false;
animator.SetBool(“Reloading”, false);
}

public void Shoot()
{
currentAmmo–;

Bullet.Play();

RaycastHit hit;
if( Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range)){
EnemyDeath enemy = hit.transform.GetComponent();
if(enemy != null)
{

enemy.TakeDamage(damage);
}
}

}

public void PistolAmmoPickUp(float Pamount)
{
if (isPistol)
{
allAmmo += Pamount;
}
}
public void ShotgunAmmoPickUp(float Samount)
{
if (isShotgun)
{
allAmmo += Samount;
}
}
public void ArAmmoPickUp(float Aamount)
{
if (isAr)
{
allAmmo += Aamount;
}
}
}

Please use code tags and provide way more information than just a code dump.
You won’t get much help like that.

What do you want the script to do and what is it currently doing?
Are you getting any error messages? Post them here if so.