"Connect is not a valid member of ClickDetector"

Hey gamers, I’m trying to create a button that opens two sliding doors when clicked using the tween service. The door itself works fine, however problems have arisen when attempting to activate it through a ClickDetector. I get this error “Connect is not a valid member of ClickDetector” on line 14, and I have zero clue why. I searched online for an answer as well as the developer forums, but in places where I’ve seen it mentioned, it’s either ignored or dismissed. I have no clue what’s causing the problem, or where I would start to attempt to solve it.

Here’s the script that I’m using.
I’m making this in a place separate from anything else, and the error mentioned before is the only error I get.

local TweenService = game:GetService("TweenService")
local Lroot = script.Parent.Parent.LRoot
local Rroot = script.Parent.Parent.RRoot
local PanelSlideInfo = TweenInfo.new()

local PanelSlideTween1 = TweenService:Create(Lroot, PanelSlideInfo, {
	CFrame = Lroot.CFrame * CFrame.new(Lroot.Size.X + 0.1, 0, 0)

local PanelSlideTween2 = TweenService:Create(Rroot, PanelSlideInfo, {
	CFrame = Rroot.CFrame * CFrame.new(Rroot.Size.X + 0.1, 0, 0)


Is there another ClickDetector named MouseClick potentionally?


This should solve your issue:


Though, it would be easier to just rename the ClickDetector to something else to prevent confusion

1 Like

Worked, thanks!! If you don’t mind me asking though, why does this work?

The ClickDetector is named MouseClick, when you were calling Connect on it, you were basically doing:


Instead of:


MouseClick is a property of ClickDector, which is what you meant to access.

The reason why I suggested renaming the click detector is because it looks like you’re accessing the property, but it’s just the Instance name.

Here’s what renaming to something like it’s basic ClassName would look like:


It’s clear and there’s less confusion on whether you’re accessing an Instance or its property

1 Like

omg lol, i honestly had no clue that MouseClick was a property of ClickDetector, thank you again :3

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.