Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make GUI button that changes properties of a part?

I'm trying to learn scripting. So I decided to train myself by making a GUI button that changes part called Red into green color then into really red color. But for some reason, it doesn't work.

local light = game.workspace.Lights

function onClicked()
	light.Red.BrickColor = BrickColor.new(Green) 
	wait(3)
	light.Red.BrickColor = BrickColor.new(Really red) 
end

script.Parent.TextButton.MouseButton1Down:connect(onClicked)

What have I done wrong in this?

1 answer

You have to put speech marks like this.

local light = game.Workspace.Lights

function onClicked()
       light.Red.BrickColor = BrickColor.new("Lime green") --You need speech marks to make it work.
       wait(3)
       light.Red.BrickColor = BrickColor.new("Really red") --You need speech marks to make it work.
end


script.Parent.TextButton.MouseButton1Down:connect(onClicked)

This discussion is preserved as it was. New answers, comments, and votes are closed.