How to make an "if" statement with the ClickDetector, for example, if someone clicks a block make something happen
COMMUNITY QUESTION
How to use ClickDetector?
1 answer
Pretend I have a brick in the workspace called "Part" and inside it is a ClickDetector and a Script
local brick = script.Parent;
brick.ClickDetector.MouseClick:connect(function()
--Put your code here
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

12 comments
Also, now Roblox allows you to see who clicked. If you want to know who clicked, put a variable name inside the function parameter.
Thanks a lot
No problem! One more thing, I noticed that you tagged this under local scripts, click detection must be put in regular scripts. Anyways, can you accept my answer if it helped you?
Hi Dewn, You're new. Like today new. Anyway... Can I send you a friend request? I have over 200 reputation, I think you can get there too pretty fast. BTW I played roblox in 2008 as a guest!
Sure, I just like helping people with CS, I'm not very active in the Roblox community though.
You joined 3/11/15.
Yeah, I didn't like my original account and wanted to start new
Really? BTW you know someone is going around the site thumbing down every answer and question so people can have negative reputation?
That would explain why my perfectly legitimate answers have been down voted.
Yep. I got 2 down votes on this answer. https://scriptinghelpers.org/questions/15487/how-to-detect-if-a-player-presses-a-key-answered#18597
I accepted your question
Are you sure, it doesn't say so?