How to Select a Child of a Model or Folder

I’m trying to use the player:GetMouse().target to get the part a player is hovering their mouse over, and delete that part.

The problem is the function returns the Model or Folder the part is inside of, which makes it hard to delete the specific child the player hovered over, especially because there are multiple children with the same name in that folder or model.

I originally thought this was just for models and so I switched to folders, but it still does this.

why not loop through all the descendants of the model/folder and check if the mouse is hovering over them

1 Like

I’ll try that, though that may contribute to lag.

Mouse.Target should return a basepart and not a folder.

So you can just do mouse.Target:Destroy().

It returns the folder the part is inside.

just use viewpoint point to ray function of current camera aand pass in the mouse x and y then cast it using find parts in ray function of workspace