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 make a script detect if I'm clicking a part while holding something in my hand?

Let's say I have a hammer in my hand and I want to use it to open a door by clicking the door while I have the hammer in my hand. How do I do that? Just so it's clear, I'm not asking how I make it so if I touch the door with the hammer, the properties change. All I know is I just insert a ClickDetector and that's it. When you're answering my question, please provide the script and a proper explaination, it can be really long or really short as long as it is easy to understand the script.

1 answer

Try looking into mouse.target and tool.Activaited Example:

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse
local tool = plr.Backpack.Tool

tool.Activaited:Connect(function(
	if mouse.target == game.Workspace.part then
		print("we found the part!")
	else
		print("Not the part :(")
	end
end
	)

2 comments

0

Will error at lines 02, 05 and 06, and please don't give scripts, scripting helpers is not a request website

0

Sorry

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