Converting .gobject Target To .gobject Select

Hello Guys im currently attempting at convert commands from arcemu into trinity.

I am currently working on the select command and cannot get it working any ideas guys.

I have managed to sort out all the commands as i want them and now i have started to convert how the object select command works so it automatic selects the nearest object so you can move / delete it instead of shift clicking the guid each time or using an addon.

This is my script for the gameobject commands

this is on the latest version of trinity core no scripts have been added or customs just changing the commands and how they work in the /server/scripts/commands directory

Error logs



really need this :confused: