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

How do I click to change my TextButton?

Asked by 4 years ago

I wanted to change the size when i click the text button i clicked the first time and i want to change the color when it's clicked second time but i don't know how to do?

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Size = UDim2.new(0,100,0,25)
    script.Parent.BackgroundColor3 = Color3.new(1, 0.0313725, 0)
end)

1 answer

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

If you want to do that you can make a value that goes up every time you click it and check it to change the size or color.

local value = 0

script.Parent.MouseButton1Click:Connect(function()
    if value == 0 then
        script.Parent.Size = UDim2.new(0,100,0,25)
        value = 1
    elseif value == 1 then
        script.Parent.BackgroundColor3 = Color3.new(1, 0.0313725, 0)
    end
end)

If you need any more help just comment to this post ?(•?•`)o

0
The methodology is correct here, but you're going to have to change the instructions inside both logic statements in order for this to work. Nckripted 580 — 4y
Ad

Answer this question