Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I identify a model/part with spaces in it?

I've tried quotes and apostrophes.

I want to make it so script.Parent.Parent.Seasoner - 1200 has the Seasoner - 1200 Identified as a model.

Edit: I know I can change the name but I don't want to, for neatness purposes, it's a tycoon.

1 comment

0

This question has already been answered here: https://scriptinghelpers.org/questions/11308/

1 answer

✓ Accepted answer

You can use square brackets to contain a name with spaces into a string. So for example, you can do ["Seasoner - 1200"] to get the object with that name.

Example:

script.Parent.Parent["Seasoner - 1200"] --Notice how there's no dot after the Parent before the "Seasoner - 1200" in square brackets. Treat the class structure as a table for names with spaces.

Also, this works for names without spaces, variables, etc.

This discussion is preserved as it was. New answers, comments, and votes are closed.