How would I make a button so when you click it the text changes to equip. Then when you click it again the text changes to unequip. Then it changes to equip and so on. The original text of the button will just be unequip.
I’m not sure how exactly to do it since every time I attempted to do so it wouldn’t work.
So I would prefer it to be in some sort of form that’s used if statements with strings. So like…
Local Button = script.Parent
If Button.Text == “unequip” then
Button.Text = “equip”
end)
If Button.Text == “equip” then
Button.Text = “unequip”
end)
The script above just breaks but I would like something along those lines.
local equipped = false
local button = script.Parent
local function onButtonPressed()
if equipped then
equipped = false
button.Text = 'equip'
return
elseif not equipped then
equipped = true
button.Text = 'unequip'
end
end
use MouseButton1Down to handle when button is clicked.
button.MouseButton1Down:Connect(onButtonPressed)