How do I to make 3D dice above 6 sides?

How do I create a 20-sided die that can be thrown, and upon landing registers a value? e.g., the die lands on 5 and sets a value of 5 inside of a global variable. If this can’t be done, I’d settle for a 10-sided die too. To sum up what I have so far… I think I have a decent glb file for a 3d model die. The die currently spins around and can be thrown, yet often it glitches out into the white borders and disappears for no apparent reason. Pictures will be included… Any help, examples, or direction would be greatly appreciated. Thank you.