Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 10 years ago

This question already has an answer here:

How to recognize a model with spaces?

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.

0
This question has already been answered here: https://scriptinghelpers.org/questions/11308/ adark 5487 — 10y

Marked as Duplicate by adark and Perci1

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 10 years ago

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.

Ad