Problem with clicking text button

  1. What do you want to achieve? Keep it simple and clear!
    I need when i click textbutton textlabel text become a mark, when i click again it unmark
  2. What is the issue? Include screenshots / videos if possible!
    idk but it’s don’t work
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Idk why this didn’t work, but this must work

My code:

local Button = script.Parent
local TextMessage = "✅"
local Text = script.Parent.Parent
local debounce = true
Button.MouseButton1Click:Connect(function()
	if debounce == true then
		Text.Text = TextMessage
		debounce = false
	end
end)
Button.MouseButton1Click:Connect(function()
	if debounce == false then
		Text.Text = ""
		debounce = true
	end
end)

Try changing the variable

local Text = script.Parent.Parent

to something like

local TextLabel = script.Parent.Parent

Besides that, if that doesn’t work, I am unsure. It might possibly be you’re using a emoji, and roblox might not be picking up on that.

Lmao what
how this even connected? Variable name doesn’t do nothing. + These script works once, but when it again become invisible i can’t click it

Like I said, I don’t know. The reason I said changing it could possibly be the fact that Text is a property, and the script might get confused with that. Besides that, I am unsure. Also, why’re you using a debounce to detect what state the text button is in?

Idk i simply could do if Text.Text = "--emoji" then , but it almost same

But debounces are supposed to be used as a cooldown, not a variable to detect what state the textbutton is in. You could try using a different variable, but besides that, no clue why your script isn’t working.

  • that can’t do script confused because Text Variable isn’t in Text Variable.

Same thing nothing changed lmao ( 30 letters)

Like I said, I don’t know why your script wouldn’t be working, everything else is fine. You could try maybe instead of having two mousebutton1click functions, just turn it into one with

Button.MouseButton1Click:Connect(function()
   if debounce == true then
   	Text.Text = TextMessage
   	debounce = false
elseif debounce == false then
Text.Text == ""
debounce = true
   end
end)

Wait i can’t just change text to " " for some reason everything fine just text for some reason couldn’t be " "

Tryed that already (30 letterssssss)

Try maybe changing the text to nil?

It’s still a better practice then two mousebutton1click functions.

No i changed text, but it’s just don’t wanna work

Wait lmao everything fine now i just used else instead of if and umm strange

local Button = script.Parent
local TextMessage = "✅"
local Box = script.Parent.Parent
local debounce = false
local Marked = false
Button.MouseButton1Click:Connect(function()
	if debounce == false then
		debounce = true
		if Marked == false then
			Box.Text = TextMessage
			Marked = true
		else
			Box.Text = ""
			Marked = false
		end 
		wait(0.5)
		debounce = false
	end
end)

Try This also i dont recommend using the same function twice in this situtation just check the text of it

Oh my bad didnt realise the topic is solved you better add solution checkmark or something lol

That’s a toggle not a debounce, you should also merge the two functions into one.