local Axe = script.Parent.Handle.Axe.Something
local Hm = script.Parent
local health = 100
local tree = game.Workspace.tree
Axe.Touched:Connect(function(hit)
if hit.Parent.Name == tree then
health = health - 30
if health <= 0 then
tree:Destroy()
end
end
end)```
It doesn't do what I write here idea of script is there variable health when it touched tree hit used then health will lose 30 and if it 0 destroy
#It doesn't destroy the tree
19 messages · Page 1 of 1 (latest)
Alright
Didn't work
Hm it means there wrong at hit
Here's picture of parents and everything
you didn't add qoutes when saying hit.Parent.Name == tree. Change it to hit.Parent.Name == "tree"
actually
nvm
How many parts does your tree have or is it just one part
Just one part
u mean it didnt print anything?
yea
did u try use the touched event on the axe or the handle?
You can see that
local Axe = script.Parent.Handle.Axe.Something
local Hm = script.Parent
local health = 100
local tree = game.Workspace.tree
Axe.Touched:Connect(function(hit)
if hit.Parent.Name == tree.Name then
health = health - 30
if health <= 0 then
tree:Destroy()
end
end
end)