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

How do I reference objects that have abnormal names? [closed]

Asked by 11 years ago

I have a part in Workspace and the name is "This is my brick". Whenever I use the code:

Workspace.This is my brick.Transparency = 1

it gives me an error. How can I edit objects with spaces or other strange characters in the name?

Locked by Articulating

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

5 answers

Log in to vote
5
Answered by
User#2 0
11 years ago

There are a few methods of doing this.

The short way is to do something like this: game.Workspace["Object Name"].Transparency = 1. It's kinda like how a table works.

Another way is to use the FindFirstChild method.

Ad
Log in to vote
-1
Answered by 10 years ago

Here is the true thing to do

game.Workspace["This is my brick"].Transparency = 1

Please note: After workspace I did not put a dot.

Log in to vote
-2
Answered by
Mr1Vgy 30
10 years ago

I do this game.Workspace["This is my brick"].Transparency = 1

Log in to vote
-3
Answered by 11 years ago

Use a specific name like "Brick". Or it might work by putting [""] around it, and it could be like this: game.Workspace.["This is my brick"].Transparency = 1 I don't know if it works, if it does, your problem is solved. If not, use a name like "Brick".

Log in to vote
-3
Answered by 10 years ago

The problem is the spaces.. Lua doesn't really like spaces in it's names. Try renaming the part without spaces. You could name it Timb (All the 1st letters of each word)