Click Detector not working

Okay, that’s understandable, you should fully check the hierarchy next time.

1 Like

For anyone wondering, Lua doesn’t use spacing for syntax so this:

script.Parent.MouseClick:Connect(function() print("CLicked") end)

is the same as this:

script.Parent.MouseClick:Connect(function()
    print("CLicked")
end)

Adding spacing isn’t the problem. The function can also be defined inside or outside the Connect call, it doesn’t really matter.

@OP:
Here are somethings to check:

  • Is the MaxActivationDistance large enough?
  • Is there something in the way of the part?
  • Is there an input bound to LMB at a higher priority? (if you don’t know probably not)
    (The previous few can be checked by seeing if the cursor changes to the pixelated hand icon)
  • Is the code running?
    (can be checked with a print statement/break point at the top of the code)
1 Like