My script can't recognize a model with spaces in its name.
How can I fix this?
Thank you.
My script can't recognize a model with spaces in its name.
How can I fix this?
Thank you.
I assume you mean "access", not recognize, in which case you'll need to use bracket access notation:
workspace["Part name With Spaces!"]
Inside the brackets can be anything that eventually evaluates to be a string (i.e. a function call or a concatenation), which is incredibly useful:
local index = 5
workspace.Rooms["Room:" .. index]
A point I like to make is that this works with normal names, too, and that it's also how . works (workspace.Rooms is the same as workspace["Rooms"])
You could also say it as a string, like or playerName == "Stealth Pilot" That works too, and it's a bit less messy than brackets all over if you're making a really long script
This is actually grossy inefficient compared to directly accessing the Object using the brackets.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Can you provide the code you used, please? :)