#Click detector on object with tools equipped

21 messages · Page 1 of 1 (latest)

misty zenith
#

The click detector needs to be inside the tree

#

Which event are you using inside the script?

#

That’s an event that fires when a part touches that part

#

Then the click detector isn’t used

#

tree.CC.MouseClick:Connect(function()

#

Hm

#

Does the script give off any errors?

misty pendantBOT
#

studio** You are now Level 2! **studio

misty zenith
#

Where is the click detector in the explorer?

#

oh

#

That’s an easy fix

#

Does the axe tool have a specific name?

#

Will there be Other axes?

#

How about we make sure it checks for all tools which name end with “Axe”

#

Then inside the function type (sorry I’m on mobile btw)

#

Equiped tools aren’t inside the player

#

They’re inside the char

#

if player.Character:FindFirstChildOfClass(“Tool”) and sub.string(player.Character:FindFirstChildOfClass(“Tool”).Name, -3) == “Axe” then

#

A single if statement

#

Which will first check if the player has a tool equipped, then check if the tool’s name ends on “Axe”

#

I did type everything up from memory so I may have misspelled something