Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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

01local cd = script.Parent
02local light = game.Workspace.WarningLight
03local Button = game.Workspace.Button.Buttn
04cd.MouseHoverEnter:Connect(function()
05    Button.BrickColor = BrickColor.new ("Bright red")
06end)
07cd.MouseHoverLeave:Connect(function()  
08    Button.BrickColor = BrickColor.new ("Institutional white")
09end)
10cd.MouseClick:Connect(function()
11    light.BrickColor = BrickColor.new ("Institutional white")
12    game.Workspace.WarningLight:Destroy()
13    Button.BrickColor = BrickColor.new ("Lime green") --turns it green until your cursor leaves the button
14end)

Trying to make it stay green

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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

1local ClickDetector = script.Parent.ClickDetector
2 
3ClickDetector.MouseClick:Connect(function()
4script.Parent.BrickColor = BrickColor.new("Lime Green")
5end)
Ad

Answer this question