What do you want to achieve? I’m trying to make a button where every time you click it it changes the text.
What is the issue? The script works just fine if its only one “else” but when I add another it breaks.
What solutions have you tried so far? I looked everywhere.
s.MouseButton1Click:Connect(function()
if db == true then
s.Text = tostring("-")
db = false
else
s.Text = tostring("/")
db = false
else -- this errors
s.Text = tostring("/")
db = false
end
end)
You are using a boolean. They have two states. If you want to cycle through a list of characters when clicking then perhaps put them in an array and have a counter variable.
local states = {
"-",
"/",
"some other symbol"
}
local db = 1
s.MouseButton1Click:Connect(function()
s.Text = states[db]
db = db % #states + 1
end)