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

How to make a button turn green when you click it?

messing around with click detectors and i made a button. Im trying to make it turn green when you press it and stay green.

local cd = script.Parent
local light = game.Workspace.WarningLight
local Button = game.Workspace.Button.Buttn
cd.MouseHoverEnter:Connect(function()
	Button.BrickColor = BrickColor.new ("Bright red")
end)
cd.MouseHoverLeave:Connect(function()	
	Button.BrickColor = BrickColor.new ("Institutional white")
end)
cd.MouseClick:Connect(function()
	light.BrickColor = BrickColor.new ("Institutional white")
	game.Workspace.WarningLight:Destroy()
	Button.BrickColor = BrickColor.new ("Lime green") --turns it green until your cursor leaves the button
end)

Trying to make it stay green

1 answer

Do you want it to turn green when somebody clicks it? if so then it would be

local ClickDetector = script.Parent.ClickDetector

ClickDetector.MouseClick:Connect(function()
script.Parent.BrickColor = BrickColor.new("Lime Green")
end)

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