So, I know the normal function would look something like this script.Parent.ClickDetector.MouseClick:connect(onClick)
However, how would you make it so it would only work when you left click it, like that it works if you left or right click.
So, I know the normal function would look something like this script.Parent.ClickDetector.MouseClick:connect(onClick)
However, how would you make it so it would only work when you left click it, like that it works if you left or right click.
You could make to to where it says script.Parent.ClickDetector.MouseButton1:connect(onClick) (which is the left button and then script.Parent.ClickDetector.MouseButton2:connect(onClick) you should try that.
MouseButton1 seems to only work with guis, but I'll give it a shot.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Doesn't appear to be a way with ClickDetectors. Try Mouse.Button1Down or .Button2Down, you will have to identify if the player is clicking the part or not, LocalScript needed. http://wiki.roblox.com/index.php?title=API:Class/Mouse This is actually a good method as ClickDetectors do not work well in FilteringEnabled games (if at all).
Try not using a Click Detector, https://scriptinghelpers.org/questions/30209/using-getmouse-instead-of-clickdetector