I'm making an Axe for my previous questions about the tree-chopping issue. But instead, I want the code inside of the tool to fire when the BoolValue called "ActivatedTool". Here's my scripts:
Local Script (Inside tool)
repeat wait() until game.Players.LocalPlayer.Character
local Humanoid = game.Players.LocalPlayer.Character.Humanoid
local Animation = Humanoid:LoadAnimation(script.Parent.ChopAnimation)
script.Parent.Activated:Connect(function()
Animation:Play()
script.Parent.ActivatedTool.Value = true
end)
script.Parent.Unequipped:Connect(function()
Animation:Stop()
script.Parent.ActivatedTool.Value = false
end)
script.Parent.Deactivated:Connect(function()
Animation:Stop()
script.Parent.ActivatedTool.Value = false
end)
Server Script (Inside Handle of Tool)
local cooldown = true
function onTouch(hit)
if hit.Name == "tree" then
if cooldown == true then
script.Parent.Parent.ActivatedTool.Changed:Connect(function()
if script.Parent.Parent.ActivatedTool.Value == true then
cooldown = false
script.Parent.ChopSFX:Play()
hit.numberOfHits.Value = hit.numberOfHits.Value - 1
print("tree has been touched by axe")
wait(1.3)
cooldown = true
end
end)
end
end
end
script.Parent.Touched:Connect(onTouch)
I really need help on this one. Can anyone explain to me why this script isn't working?
Regards, Sensei_Developer

6 comments
Wrong syntax, it should be coroutine.resume(coroutine.create(function() end)) you can’t create a resuming coroutine
Oh sorry it's a typo, Thanks for telling me it's now fixed!
Okay, I'll try it out.
Read the bottom post:
Did you fix it?
It won't work due to FilteringEnabled. Any changes you make on the client the server cannot see. You can use RemoteEvents to make a workaround though