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

how do you detect if player clicks a model with a tool?

im trying to make a tool named shovel and when it clicks on a model, inside of the model a part change size, im trying to detect it but mine just breaks. How do you accurately detect it?

1 answer

✓ Accepted answer

If player equips tool, this appears at his model. Here is code

ClickDetect = YourWayToClickDetector --There your way to click detector
function Click()
	for _, i in pairs(script.Parent:GetChildren()) do --Starts searching
		local Name = tostring(i.Name)
		if Name == "Trowel" then --Checks that player equipped tool, put there your tool name
			-- Your Code there
		end
	end
end
ClickDetect:Connect(Click)

2 comments

0

what do you mean by "there your way to click detector?

0

You need to create a instance named "Click Detector" and parent it to a part you need to click. you can read about it there: https://developer.roblox.com/en-us/api-reference/class/ClickDetector

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