I don't know where this script goes.

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

public class statroll : MonoBehaviour {

    void Start() {

    for(int x = 0; x < 20; x++)
    {
        int str = 0, agi = 0, inte = 0;
        int statroll = Random.Range(1,3);
        switch (statroll)
        {
        case 3:
            str++;
            break;
        case 2:
            agi++;
            break;
        case 1:
            inte++;
            break;
        default:
            Debug.LogError("Something went wrong, probbably with my Random.Range bounds!");
            x--;
            break;
        }

    }

}
}

I’m trying to make a button that rolls your stats, but I’m not sure what to do with this script. I tried attaching to a button, but it doesn’t do anything.

try adding this to the end just ouside the case code to check if it is running.
Debug.Log(“str=” + str + " :agi=" + agi + " :inte=" + inte);

as you have added it to the start, it will run when the button is setup (Program started) and not when the button is clicked

How do I add it so when the button is clicked it randomizes.

create your own function eg. public void RandomizeStats(){" etc
Then from the button inspector window update the on click event to link to your script and this function

Ok, thanks for the help. Again lol