How to to check when a player is clicking a part without a click detector

Hello!

I want to make a grapple gun but I only want it to work on specific parts.
This can be done with a table and then select every part that u want to use and change the name to pizza for example and then put pizza inside the table.

Then the script will check if the mouse that is clicking on a part is called pizza or anything inside that table and then drag u to the part that u clicked.

Why not use a click detector? Well, I would need to make a new script for every single part called pizza and then also send info to the tool (the grapple gun) that I have to be launched. U also have to change the distance from how far away u can actually click it. I don’t want a limit on it.

So my problem:

There is a function called: Mouse.Hit (I want to use, but how do u check what part its hitting? It only gives the position)

If there is any other way, let me know!
Thanks for the help.

1 Like

Mouse.Target returns the BasePart the mouse is hitting, or nil if the mouse is touching nothing

6 Likes

Oh wow, I should look more into the properties! Thanks for the help! I can finish making my project now.

2 Likes

Good luck on your project! If you have anymore issues don’t be afraid to make another post!

1 Like