This script makes the button's border turn blue when clicked, but it only stays blue for a second, then goes away. How do I make it stay blue until its clicked again?

local BUTTON = script.Parent
local SELECTED = false


function on_button1_down()
	
	if BUTTON.Text == "Cow"
		then 
		SELECTED = true
	end
	if SELECTED == true 
	then	
	BUTTON.BorderSizePixel = 4
		BUTTON.BorderColor3 = Color3.new(0, 255, 255)
		BUTTON.BackgroundColor3 = Color3.new(85, 255, 255)
		print("success")
		
		wait(5) BUTTON.BorderColor3 = Color3.new(0, 255, 255)
end
end
BUTTON.MouseButton1Down:connect(on_button1_down)

2 comments

0

In line 21 instead of using the MouseButton1Down event, try using the MouseButton1Click event.

0

Perhaps you have AutoButtonColor on, and it's changing the colors on you? I doubt it, though.