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?
✓ ANSWER ACCEPTED
how do you detect if player clicks a model with a tool?
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)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
what do you mean by "there your way to click detector?
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