Maxscript help changing name of objects

Hi all

I have an array of objects
inside

    countBB = 0
    for obj in bbObjsArr do

        obj.name = "sdgfdgf" + countBB
countBB = countBB + 1

)

But its not working
even if I say
thisnumber = countBB as String
and then change the naming to
obj.name = “sdgfdgf” + thisnumber

it still doesnt work

Using ‘as string’ should work.

This works for me:```
(
local objsAR = getCurrentSelection()
for i = 1 to objsAR.count do objsAR[i].name = “NewName” + i as string
)

You could also use UniqueName() then you don’t have to add the numbering yourself.

Could you elaborate a little on that one?

How would I use it in my example code?

With your code it would be something like:

bbObjsArr = getCurrentSelection()
for obj in bbObjsArr do
      obj.name = uniquename “Name”

Both work great, but for the current situation, uniquename worked better
Thanks guys