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

How do I make a gui button that everytime you click on it it changes to another word?

Asked by 3 years ago

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

Log in to vote
0
Answered by 3 years ago

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.

0
ayy thanks bro MrAdrianGo 9 — 3y
0
It worked thanks MrAdrianGo 9 — 3y
0
no problem. mastercheeseit 77 — 3y
Ad
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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)
0
im sorry, but it didnt work, thanks for trying to help tho MrAdrianGo 9 — 3y
0
Are you sure? It works fine here. aurich98 86 — 3y
0
ohhhhhh, i got it wrong lol sorry MrAdrianGo 9 — 3y
0
thanks for the help!! MrAdrianGo 9 — 3y

Answer this question