Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

connect is not a valid member of ClickDetector?

Asked by
Peeshavee 226 Moderation Voter
8 years ago

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:

01local cf = game.Workspace.cfrme
02local db = false
03 
04 
05function move(hit)
06    local human = hit.Parent:FindFirstChild(hit)
07    if not db then
08        if human then
09 
10            db = true
11 
12            for i = 3, 1, -0.1 do
13            cf.CFrame = CFrame.new(Vector3.new(-5.8,6.7,68))
14            cf.CFrame = CFrame.new(Vector3.new(-5.8,i,68))
15            end
View all 23 lines...

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

Log in to vote
1
Answered by 8 years ago
Edited 8 years ago

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

1local human = hit.Parent:FindFirstChild(hit)
2 
3local human = hit.Parent
0
Oh my gosh. I'm so stupid. I put hit in the brackets instead of humanoid. Wow. Thanks. Peeshavee 226 — 8y
0
no problem :P it happens RobloxianDestory 262 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

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

1cf.ClickDetector.MouseClick:Connect(move)
2 
3cf.ClickDetector.MouseClick:connect(move)
0
Even when I changed that, it still doesn't work. Any other help? Peeshavee 226 — 8y

Answer this question