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?
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?
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.
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.
I do this game.Workspace["This is my brick"].Transparency = 1
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".
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)
This discussion is preserved as it was. New answers, comments, and votes are closed.