ClickDetector won't work through invisible parts and models?

So, I started working on a Character Customization system for my project and I’ve found a little problem.
I’ve got a part which got a ClickDetector inside of it. ClickDetector’s MaxActivationDistance is set to 70.


However, there is a Clothes model and another TouchPart in front of Part which has got a ClickDetector.

When I test out my game, I can’t click on that part, because there is an obstacle in front of it.

In a test mode, when I change my camera and look beside of that part, I can actually click on it.

I tried a method to make all these parts CanCollide Off, but that doesn’t work either.

Is there any solution how to fix this?

1 Like

Use Mouse.Target with a filter?

1 Like

Yeah I would go with voidage, and use Mouse.Target and probably use the part in front to get the item of currently being hovered/clicked. Or go with the model and saying this with no extra parents and get the name of the model clicked.
The wiki doesn’t show a .Target after using the :GetMouse(), but I’m sure it’s there
Ex

local mouse = game: GetService(“Players”).LocalPlayer:GetMouse()
Mouse.Button1Down:Connect:function()
if not Mouse.Target then return end
print(Mouse.Target.Name)
end)

Gotta love mobile formatting…

No, the ClickDetector won’t work if they are behind invisible parts. That is why I have been working around it by sizing up the “hitbox” of the part.

You could try an alternative solution such as this, just like the posts above. When the mouse hovers over the object, Mouse.Target returns a BasePart(or an object in the 3D space). However, when the mouse points at the sky, it’ll return nil.

Also try this for ignoring certain models or obstruction when the mouse hovers over them, if you want it to be clicked even with obstruction.

5 Likes

Other than the solutions mentioned above; you can consider removing the transparent parts locally, if they are only needed server-sided. However this is more of a work-around than a solution.

2 Likes