Converting variable to a string

I’m just trying to convert the name that newchild is equal to to a string in a server script, but it doesn’t want to work.


I know the folder location is correct as well cause I have tired printing the New Child, I have tried using “.Name” as well and that didn’t make any difference.

this similar code works fine in a local script:

1 Like

What’s the error output? Can you send a screenshot of that.

I don’t get any error but I do get this, the print above the orange text is what get’s printed when adding print(tostring(NewChild) and when the part is added to the folder location

btw this script worked when I added the specific name of the part that I knew would be cloned to the folder

try and loop through the world model to see if one of the childrens name matches up to the child’s name and if it does destroy it

I use this simple four loop and it printed everything correctly but “:Destroy()” still didn’t work.

if you found the part and you want to delete it just do child:Destroy() and don’t bother doing the whole script.Parent.Parent thing

yeah that is true, but now I tried using wait() and that solved the whole issue, it might be because I am cloning the gun at the same time in the same script, but thanks for the support any away
Working script:

What I really wanted to do was to destroy the child in this folder location before cloning in a new part and for that this script works a lot better:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.