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!
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
"Connect" is supposed to be "connect" A common mistake
cf.ClickDetector.MouseClick:Connect(move) cf.ClickDetector.MouseClick:connect(move)