Find a part using Mouse.Target

Im trying to make a script here when you click a part, it deletes it.
I made it so that when you click with your mouse, it detects it on a local script and fires a event with the mouse.Target and on a server script it detects it.

But my problem, is that I cant use the name to find it in for example blocks:FindFirstChild(hit) since all the parts have the same name?

Is it possible to find a part without using the name but using the object info provided in the mouse.Target function?

You can use :GetPartBoundsInBox() to see what parts are near the Target

you could just do

blocks:FindFirstChild(mouse.Target)

Try using raycasting + mouse.Hit.p or something else simular to that with raycasts.

According to the documentation, Mouse.Target should return a BasePart instead of a string; why can’t you use it directly?
Mouse | Documentation - Roblox Creator Hub

1 Like

Yeah, i didnt know you could use it directly. Thx for helping

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.