Im trying to change the material of a brick... This is my script that I made but does not work.
while true do game.Workspace.Part.Material = (Wood) wait(1) game.Workspace.Part.Material = (Foil) wait(1)
A string is needed, otherwise, Wood and Foil are not defined, so they would be read as nil, you were also missing an end
.
Here's the script:
while true do workspace.Part.Material = "Wood" wait(1) workspace.Part.Material = "Foil" wait(1) end
Consider reading about strings this will help you understand what strings are and how to use them.
Hope it helps!
First of all, loops create scopes. In the output, whenever you see 'end' expected
...blah blah... near <eof>
, it means you need to put "end" at the end of a scope.
Second, get rid of the parenthesis. Use quotation marks to change properties that want strings. Strings in programming are basically just words, or text in general.
while true do workspace.Part.Material = "Wood" --Protip: You can use "workspace" instead of "game.Workspace" to refer to the workspace. That only works for workspace. wait(1) workspace.Part.Material = "Foil" wait(1) end
More about scopes: http://wiki.roblox.com/index.php?title=Scope