How would make it so that I can still click on parts with click detectors when they are behind a part that's invisible but has canCollide=true

As stated above,
I am trying to achieve this effect:


(example is from De Pride Isle Sanatorium by Divine Sister, owned by Valindra)

Does anyone know how I would go about scripting this?
I have tried multiples methods on my own trying to replicate this but haven’t been successful.

Any and all help is appreciated.

ClickDetectors do not account for mouse.TargetFilter so I’d suggest using either a mixture of mouse.Button1Down or a raycast from the camera/character position towards mouse.hit.p.

For mouse.Button1Down, you can make it ignore a part using mouse.TargetFilter, as for raycasting, you can add do one of the two,

Use a whitelist raycast and set the doors in the filter table, or use a blacklist raycast and set the invisible parts in the filter table.

Below’s a quick example,

local client = game:GetService('Players').LocalPlayer
local cam = workspace.Camera
local mouse = client:GetMouse()
local clickRange = 150

mouse.Button1Down:Connect(function()
	local origin = cam.CFrame.p
	local direction = CFrame.new(origin,mouse.hit.p).LookVector*clickRange

	local params = RaycastParams.new()
	params.FilterType = Enum.RaycastFilterType.Blacklist
	params.FilterDescendantsInstances = {
		client.Character,
		workspace.InvisiblePart,
	}
	local result = workspace:Raycast(origin,direction,params)
	if result ~= nil then
		print(result.Instance)
		-- verify and do what you want with the part here / fire a remote if the change should be on the server.
	end
end)

Note that you can also put folders in the filter list and it will ignore everything in them, thus workspace organization is important for efficiency :+1:

So this sorta is the effect I’m going for, but, in the example video I provided, there is a click detector in the doorknob that is being activated and allowing for the door to open, how would I achieve that from where we are now?

Bit confused here, which part of the video shows that it’s using a click detector? From what I know clickdetectors doesn’t account for target filters, why not fire a remote instead to tell the server that the player opened that door, and then send a signal to all clients to open the door on their clients?


(fixed the issue I was having with the video upload.)

Here’s a clip of me showing the door having a click detector, in hindsight, should’ve shown it had one in the original video
(Late reply because of technical issues)

Hard to say I’d agree, the icon doesn’t necessarily mean it’s a click detector, it’s likely that they just change the mouse icon if it hovers over a clickable part to show that it’s clickable, I do this to some of my games as well.

I don’t think that’s click detector or that you can filter something for a click detector, but again, this is based off of what I personally know, which means I could be wrong.

Make the door handle’s touch part extend beyond the door (and invisible).