V
1)add a bool value in the character
2) when equpping the tool , use the equip event(check dev) to
boolValue.Value = true
and vice versa for unequip.
3)when the click detector fires, first check if the boolvalue is true(
you will get the player from the click event, idk if u get the character, but if u get the player just do
local Character = player.Character -- the player will be given by the event
)
below would probably be how the code(Click detector) would look like
#Choppable Tree
1 messages · Page 1 of 1 (latest)
local Tree = --where ever your tree is
local Trunk = Tree:WaitForChild("Trunk")--dont need this if your tree is a single part
local function TreeChop(player)
local Character = player.Character
local Humanoid = Character:FindFirstChild("Humanoid")
if Humanoid then
local IsHolding = Character:FindFirstChild("BoolValue") --wherever u kept it
if IsHolding.Value then
--whatever u want here vvv
--chop
--whatever u want here ^^^
else
print(player , "Not holding axe")--used for debugging to see if it works, remove it later
end
end
Trunk.MouseClick:Connect(TreeChop)
i recommend using getmouse in the tool instead of a click detector for all this hassle