Is there a way to make a click detector ignore a certain part?

So I was wondering, can I make it so that a click detector will act like a certain part is not covering it when it actually is so that the player could click through the part?

3 Likes

Can you elaborate on this? what are you trying to do? Yes it can be done.

1 Like

According to this forum…

…you can filter out the object covering the click detector by scripting this in a local script:

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local mouse = Player:GetMouse()
mouse.TargetFilter = --path to object you'd like to filter
3 Likes

I don’t personally see anything wrong with that statement.

1 Like

Ryuun’s statement, it’s perfectly logical.

1 Like

Woah woah woah 9 posts arguing about a small error. Chill out guys please.

Unfortunately, I tested this and it does not work for click detectors in parts.

1 Like

Try this I hope this works!

NOTE: Make sure to add the ClickDetector. DO NOT ADD IT Into the ClickDetector but add the ClickDetector and the script in the model.

local tool = game.ServerStorage["Hot Cup"]

local klone = tool:clone()

script.Parent.ClickDetector.MouseClick:connect (function(plr)

if klone.Parent ~= plr.Backpack then

klone.Parent = plr.Backpack

else

end

end)

Unfortunately, this is actually not possible with Click Detectors. If you want a player to click a part that’s blocked by another, you’ll have to filter out the object inside a local script like so…

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local mouse = Player:GetMouse()
mouse.TargetFilter = --path to object you'd like to filter

…and check if the client clicks/taps on the part.

local button = --path to button
Mouse.Button1Down:Connect(function() --for every time a player clicks/taps
	local target = mouse.Target
	if target == button  then --checks if what the player clicked is the button

	end
end)
2 Likes