how do i fix this function?

attempt to call method ‘GetSelectedItems’ (a nil value),
there is something to replace this function?

You need to post your code.

Snip - OP is banned.