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 make a gui button that everytime you click on it it changes to another word?

I want to make a mute and unmute textbutton when you click on it, the word changes to unmute and when you press it again, it changes to mute, but idk how to script it, soooooooo can any of yall help me?

2 answers

✓ Accepted answer

Here you go :

script.Parent.Text = "Mute"
script.Parent.MouseButton1Click:Connect(function()
	if script.Parent.Text == "Mute" then
		script.Parent.Text = "Unmute"
	elseif script.Parent.Text == "Unmute" then
		script.Parent.Text = "Mute"
	end
end)

If this helps accept the answer! Let me know if you find any problem or if it's not what you wanted.

3 comments

0

ayy thanks bro

0

It worked thanks

0

no problem.

Using a TextButton's MouseButton1Down event and its Text property

local Button = (button here);
Button.MouseButton1Down:Connect(function()
	local isText = (Button.Text == "Mute"); -- Is the text "mute?"
	Button.Text = (isText and "Unmute" or "Mute"); -- If yes then change it to "Unmute", if its not then make it "Mute".
end)

5 comments

0

im sorry, but it didnt work, thanks for trying to help tho

0

Are you sure? It works fine here.

0

ohhhhhh, i got it wrong lol sorry

0

thanks for the help!!

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