How to make a unique Name from everything

Hey devs. lets say I’m trying to make a unique name. Like unique in the fact that if I search for it via explorer, it will be the only result. So no descendants and children can be named this special string. How do I make this effectively?

Because while I can loop through thousands of parts and compare, but this uh… seems not efficient at all. Any ideas?

7 Likes

Make a plugin that has a number and saves that number, then every time a part is created make the plugin set its name to the number, one of the simple ways to do it

4 Likes

Hey we were talking about this the other day! Just loop through all the descendants, and name them “Descendant”…i

2 Likes

While like thats not what I want.

I need to run a ‘filter’ to check that nothing else has this name. If it has that name then it reruns and makes a new string,

3 Likes

If not model:findfirstchild(“Descendant”…i)
I’ve made a plugin called uniquerename that should encapture how you want your system

2 Likes

OMG hey! Thats funny your helping me with this.

You can assume what project this is for, but I have expanded more on this idea, with including more customizing, like a base string, min, max characters etc.

Well I also want to compare everything around it, and not force eveything else to have a different name. rather you have a base string “Base” and then the option to add Numbers/letters after the base via. BaseWord9g840q Only issue is that I want to compare this, with well ‘every object’… in the sense that no 2 objects have the name. Is the only way to do this is by Descendants?

1 Like

I don’t know what that means, I was up almost all night helping people with scripting questions so my brain isnt working quite right rn, do you mean every object that exists in your whole game?

Yep.

From scripting from quite some time, I don’t like to use all games Descendants to compare, because while getting every part and comparing it, seems like a whole lot of lag, and if I want to make like a lot of unique names, seems likes a big mess, but maybe I am wrong.

1 Like

you might want to look into

HttpService:GenerateGUID()

HttpService | Documentation - Roblox Creator Hub

I have seen that, but in this case I am making a plugin, and wnat the names to be readable to people and short, not long and scary names. while still be unique

1 Like