Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I detect parts with tools?

I am going to make a dig tool for my game, but I need to know the name of the model I click on? How would I do this, and is there a simple method? Any help would be appreciated.

1 answer

Use the mouse.Target method. It gives you the object that the mouse is pointed at.

For example:

local mouse = game.Players.LocalPlayer:GetMouse();
mouse.Button1Down:connect(function()
	print(mouse.Target); --Will print the target that you click on.
end

1 comment

0

You should mention that this should be in a local script.

This discussion is preserved as it was. New answers, comments, and votes are closed.