I am new to programming and i dont know how to fix this
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PickupSystem : MonoBehaviour
{
// Start is called before the first frame update
int pickupAmount;
void OnCollisionEnter2D(Collision2D other)
{
if(other.collider.name=="Player" )
{
gameObject.GetComponent<PlayerStats>().pickupMoney(pickupAmount);
pickupAmount = Random.Range(6, 32);
Destroy(gameObject);
}
}
}
I have the pickupMoney method in the playerstats script