In my inventory system, I need to be able to use the selected item in the hotbar. This is the script I use to get the hotbar's current item.
This normally works but whenever there is not an index for the activeitemslot I use, It crashes. For example, It crashes whenever the only item in the inventory is in the first slot but the active slot is the second. I only need it to run whenever the index actually exists.