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

Simple click GUI works, then immediately goes away?

Asked by 8 years ago

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)

0
In line 21 instead of using the MouseButton1Down event, try using the MouseButton1Click event. FireFruit226 35 — 8y
0
Perhaps you have AutoButtonColor on, and it's changing the colors on you? I doubt it, though. iconmaster 301 — 8y

Answer this question