How to spawn ONLY ONE collectible in the game

Thank you for answer! However, I am getting an error when trying to get a random element from the array. My code:

@editable
ListaViales : []collectible_object_device = array{}

OnBegin<override>()<suspends>:void=
    RandomIndex : int = GetRandomInt(1, ListaViales.Length - 1)
    ListaViales[RandomIndex].Show()

In that code, “RandomIndex” in the last line is underlined and the error is the following:

This invocation calls a function that has the ‘decides’ effect, which is not allowed by its context.

How can I solve it?