I have a Text button but I cant click it using MouseButton1 Click?

I have a Text button but I cant click it using MouseButton1 Click?
My script:

PlayerGui.MainUI.PhoneMain.OverlayContent.CloseButton.MouseButton1Click:Connect(function()
	PlayerGui.MainUI.PhoneMain:TweenPosition(
		UDim2.new(0.006, 0,0.988, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)

go down

PlayerGui.MainUI.PhoneMain.OverlayContent.CloseButton.MouseButton1Down:Connect(function()
	PlayerGui.MainUI.PhoneMain:TweenPosition(
		UDim2.new(0.006, 0,0.988, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)

Still does not work for some reason

Is the TextButton.Active property set to true?

could have something blocking that button
Screenshot 2022-12-24 104408

2 Likes

Ive set it ZIndex to 100 and it still doesn’t work

I’m pretty sure this can’t be a server script, change it to a local script.

it is a localscript its in startercharacter

Have the script be within the MainUI thing instead of starter character

The weird thing is I have something were I click a ImageButton and it works just fine in the same localscript

Regardless, UI related scripts should be in the UI itself, not the character.

If you put a print statement within the function, does it output to console?

All client scripts should reside in StarterPlayerScripts. When using RunContext you can also use ReplicatedStorage and more.

It doesn’t have to just be in the UI, you can also put them into StarterPlayerScripts and have it run there and just call ...LocalPlayer.PlayerGui:WaitForChild("GuiName") to retrieve it then do stuff with it.

Something is blocking the button, a text an image or an invisible item, changing Z-Index won’t fix this so your best choice is to move it out of the way or remove the item from it’s children.