Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

connect is not a valid member of ClickDetector?

So, I'm working on this CFrame script, where a part starts at one position and goes through an another brick, which is in a new position. Here's the script:

local cf = game.Workspace.cfrme
local db = false


function move(hit)
	local human = hit.Parent:FindFirstChild(hit)
	if not db then
		if human then
			
			db = true
			
			for i = 3, 1, -0.1 do
			cf.CFrame = CFrame.new(Vector3.new(-5.8,6.7,68))
			cf.CFrame = CFrame.new(Vector3.new(-5.8,i,68))
			end
			
			db = false
			
		end	
	end
end

cf.ClickDetector.MouseClick:Connect(move)

When I click the brick, nothing happens, and output says "Connect is not a valid member of ClickDetector". What have I done wrong here? All help is appreciated!

2 answers

✓ Accepted answer

remove :FindFirstChild(hit) from line 6, it worked for me when i tested this script in studio

local human = hit.Parent:FindFirstChild(hit)

local human = hit.Parent

2 comments

0

Oh my gosh. I'm so stupid. I put hit in the brackets instead of humanoid. Wow. Thanks.

0

no problem :P it happens

"Connect" is supposed to be "connect" A common mistake

cf.ClickDetector.MouseClick:Connect(move)

cf.ClickDetector.MouseClick:connect(move)

1 comment

0

Even when I changed that, it still doesn't work. Any other help?

This discussion is preserved as it was. New answers, comments, and votes are closed.