Help with changing Text board

Hello! I recently wanted to build a quite unprofessional text board that changes when you click it. This is my code:

Text1 = ("ExampleText")
Text2 = ("MoreExampleText")




local Value = game.Workspace.TestBoard
local parent = script.Parent
local Button = script.Parent.StartButton.Button
local Find = script.Parent.SurfaceGui

function first()
	Find:FindFirstChild("TTest").Text = Text1
	script.Parent.StartButton.Button.ClickDetector1.MaxActivationDistance = 0
	Button.ClickDetector2.MaxActivationDistance = 32
end

function second()
	Find:FindFirstChild("TTest").Text = Text2
		script.Parent.StartButton.Button.ClickDetector1.MaxActivationDistance = 0
	end

if game.Workspace.TestBoard.SurfaceGui:FindFirstChild("TTest") then
	wait(15)
	Button.ClickDetector1.MaxActivationDistance = 32
	
end




Button.ClickDetector1.MouseClick:Connect(first)
Button.ClickDetector2.MouseClick:Connect(second)

This code doesn’t work and for some reason nothing comes up in Output. You can change the entire script if you want, I just want it to work. Thanks

local Text1 = "ExampleText"
local Text2 = "MoreExampleText"

Use MouseButton1Clicked:Connect

Incorrect, MouseClick is the legal signal to be used when the player clicks for ClickDetector.

Both are similar and they can be used. Nothing is wrong with that

Wdym both are similar? MouseClick is the only documented event listener under the API, whereas MouseButton1Clicked is for GuiObjects

It kind of works now, but it doesn’t switch to “MoreExampleText”

Text1 = "ExampleText"
Text2 = "MoreExampleText"

local Value = game.Workspace.TestBoard
local parent = script.Parent
local Button = script.Parent.StartButton.Button
local Find = script.Parent.SurfaceGui

function first()
	Find:FindFirstChild("TTest").Text = Text1
	script.Parent.StartButton.Button.ClickDetector1.MaxActivationDistance = 0
	Button.ClickDetector2.MaxActivationDistance = 32
end

function second()
	Find:FindFirstChild("TTest").Text = Text2
	script.Parent.StartButton.Button.ClickDetector1.MaxActivationDistance = 0
end
	

Button.ClickDetector1.MouseClick:Connect(first)
Button.ClickDetector2.MouseClick:Connect(second)

Nvm, I found out that 1 part doesn’t really work with 2 Click detectors.

Oh, right silly of me to not notice that XD.

I mean both are event listeners

Yes, but the latter wouldn’t work for OP’s issue as he is using a ClickDetector and the latter applies to GuiObjects like ImageButton and TextButton.