I am very new to scripting, and I have played LBP2, and LBP3 and the Techno seems so simple. But Roblox's LUA seems so difficult. I want to make a little booth, where you click a SurfaceGUI of a certain color, and many parts turn colors. For example, a player hits a Blue SurfaceGUI, then 10 blocks infront of the player turns Blue. Or a player hits a SurfaceGUI and bricks infront of him turn random. I do got an idea on what to do, but I need help on the Click thing. Here is what I would do. Just tell me if I do anything wrong. Can you help me?
if (Something where a player hits a SurfaceGUI) then Game.Workspace.DanceFloor.Part1.BrickColor = ("Toothpaste")
But I want it to also work on multiple parts.
I tried using:
function color() Game.Workspace.Part.BrickColor = ("Toothpaste") end script.Parent.MouseButton1Down:connect(color)
But i get the error:
"Workspace.ColorThePart.SurfaceGui.TextButton.Script:2: bad argument #3 to 'BrickColor' (BrickColor expected, got string)"
Can someone help me with this??
If I understand your question correctly, What you're trying to do is change the colour of some blocks when a surface GUI is clicked.
function onClick(clicked) -- This makes the rest of the code run when it's clicked game.Workspace.DanceFloor.Part1.BrickColor = BrickColor.new("Toothpaste") -- What you want to happen script.Parent.MouseButton1Down:connect(clicked) -- Connection line
I believe what you're missing is the BrickColor.new
If this doesn't answer your question fully, or you don't understand please do reply or send me a PM :) But if it does answer your question don't forget to accept my answer :)
Nevermind, I found a way to do it! Just put this into a brick! Also, thanks to everyone who helped me with my little flaw. :)
function color() Game.Workspace.Part.BrickColor = BrickColor.new("Toothpaste") end script.Parent.MouseButton1Down:connect(color)