# Can't set parent of sprite by name

If I just plunk down in the scripting area:

where "box" is a sprite name, nothing happens, the parent isn't changed, there is no error.

However, if I try this in a script (using 'tell ...'), I get a TypeError: can't read property cloneOriginName of null.
I have a workaround for this, but am wondering about the lack of error in the first case, and also if the set by name seems like a reasonable thing to be able to do. The lack of error in the first instance initially led me to believe it was working and took me down a path that required the workaround.

If you just type the name, it doesn't work, but if you put the object reporter in the input like this
then it will work (you can see the parent of the sprite by using this block )

Yes, I wrote a simple reporter to walk the list of sprites and return the one with the name I wanted: the workaround. other questions are still on the table.

It should be possible to use the join block to set the parent to the sprites you want like a car with the JavaScript function block, but I have not tested it yet (because I am on my mobile).

Maybe the context will help: I'm creating clones and giving them names and parents, so I wanted to refer to the parents by name.

I don't get that idea, and am pretty uninterested in JavaScript at this point; no offense. I also have a solution to the original problem - maybe I should have posted this to another topic.

I cannot think of a simple solution to the problem without it because the set ____ to ____ block only lets you set values for vars.

the empty object return at the end, on failure, doesn't really work, but if there is a sprite with the desire name, it does

here's a much much simpler way to do it
if the sprite does not exist, it doesn't report (and it doesn't throw an error) you can also ask for the sprite that you're in, so if you're in the sprite "sprite" and you type in sprite, then it will report itself. It'll also report itself if you type in myself.

excellent! and really amplifies my initial question about the 'set parent' not working with names.

I guess this is mostly a question about error reporting, but I think the ask and tell blocks introduce some confusion between a sprite and its name - I'm not suggesting to change that.

You can just do

One step further: just don't make the sprite with name reporter