Is that your whole code, I assume it’s not, but what I would do is I’d just debug the whole code, explore is. Look where your accessing the index and see if it is null or doesn’t exist or something like that. It might be a bit hard to find where it is but you’ll get there, posting your whole would be a good choice as well
Ok I just looked at when you said [quote=“Kurt-Dekker, post:2, topic: 858620, username:Kurt-Dekker”]
remember you might have more than one instance of this script in your scene/prefab
[/quote]
and saw that it was instantiating two of the same prefabs that had the script instead of one which would cause the script to be run more than once. Thanks, sorry for posting such a small mild inconvenience.