Why am I getting this error?

So I get this error

08:51:56.046 - MouseButton1Click is not a valid member of TextLabel "Players.OozyMage.PlayerGui.TasksGui.TaskBarBackground.TaskListBackground.TextLabel"

My script is

local open = true
local speed = 1

local frame = script.Parent.Parent.Parent.TaskListBackground

script.Parent.MouseButton1Click:Connect(function()
	if open == true then
		open = false
		frame:TweenPosition(UDim2.new(-0.724, 0,1.625, 0),'Out','Quart',speed,true)
	else
		open = true
		frame:TweenPosition(UDim2.new(0.041, 0,1.875, 0),'Out','Quart',speed,true)
	end
end)

Seems like you are doing a MouseButton1Click on a TextLabel , that doesn’t exist. Change to a TextButton

1 Like

(scroll down to events)

Try using the events InputBegan and InputEnded to detect a full click. Shame they don’t have the Activated event here. You will have to “hack” cross compatibility.

Edit:
Go with TextButton and use the Activated event. It seems like the only GUI object with the event.

Ohhh okay let me try brb. :heart:

Thank youu it worked! :heart: :heart:

1 Like