Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I click to change my TextButton?

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

✓ Accepted answer

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

1 comment

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.