So I am trying to make a block that’s basically a dice roll for a shortcut but half of the time it does both sides of the if statements.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RNG : MonoBehaviour
{
public GameObject edge;
public int rngval;
void OnTriggerEnter2D(Collider2D col)
{
rngval = Random.Range(0,2);
if(col.tag == "Player")
{
if(rngval==0){
Destroy(gameObject);
Destroy(edge.gameObject);
} else {
col.transform.position = CheckPoint.GetActiveCheckPointPosition();
Destroy(gameObject);
}
}
}
}