Ad
Log in to vote
0

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

Asked by 2 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.

Hi.

Looks like you're using an ad blocker.

That's fine...

No, it really is.

Just, I mean, we put a lot of work into this site, you know?

It would be really really appreciated if you would turn off your ad blocker for our website...

We tried really hard to make our ads as unobtrusive as possible.

If you really hate ads, would you consider a $2 donation via Patreon?

Here's the link.

We love you. We hope you love us too.

.

..

...

Now back to your regularly scheduled Scripting Helpers....

...

..

.

5 answers

Log in to vote
5
Answered by
Everesty 955
2 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 2 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 25
2 years ago

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

Log in to vote
-3
Answered by
Keanu73 95
2 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 2 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)

Ad