ClickDetector not firing mouse click?

Hello, this happen recently to one of my old features. Just broke today actually.
If anyone could help me with this. the part is visible and can collide. But when ever I click on it, the mouse click event is not firing at all even tho the mouse click icon is showing. Any help would be appreciated. Sorry for anything bad grammar!

1 Like

Can you show the script you used?

yes sir
ClickDetector.MouseClick:Connect(function(Player)
print(''Clicked")
end)
yea when testing this simple script this didnt fire (when I was debugging)

1 Like

Are you using a local script? Because MouseClick only works on the server.

1 Like

I am using a server script, I tested the same script I posted in other studios and still nothing

Wow. I’m stumped. I have never had this problem before.

Maybe file a bug report, because there is no flaw in your code.

Alright thank you for the help

It should work fine, just make sure your getting “ClickDetector” properly.

yea ClickDetector is defined as script.Parent. I wouldnt know what would be wrong on that or something.

Maybe you ment to use

script.Parent.ClickDetector

instead? Or is the script under the ClickDetector in the explorer?

The script is parented to the clickdetector

If the script is under the clickdetector, you should add another parent.

I have tried that. I also tried making a instance.new and connecting to it on the mouse click and still no fire (could this be a bug with my studio? because it also dosent work in game)

Is there anything else going on? Any errors or prints in output?

No output at all. I even put it in a pcall to even see what would happen but nothing still.

Try create a click detector and put on your part. Create a script and parent it to part. (Not clickdetector).

local part = script.Parent 
local clickdetector = part:WaitForChild("ClickDetector")

clickdetector.MouseClick:Connect(function()
   print("Clicked")
end)

Yep I created a part added a click and made a script not parent to the part and still no event firing

Weird, I just tested it and it work…

local part = script.Parent 
local clickdetector = part:WaitForChild("ClickDetector")

print("Loaded")

clickdetector.MouseClick:Connect(function()
   print("Clicked")
end)