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 3 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.

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

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

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)
Ad

Answer this question