I have made a chop-able tree script and it works, sort of.
local a = script.Parent
local b = script.Parent.Log
local c = script.Parent.Log2
local d = script.Parent.Log3
local e = script.Parent.Log4
local f = script.Parent.Leaves
local g = script.Parent.Leaves2
local h = script.Parent.Leaves3
local i = script.Parent.Leaves4
local hits = 0
local hitsN = 16
b.Touched:connect(function(hit)
if hit.Parent.Name == "Basic Axe" then
hits = hits + 1
if hits == hitsN then
hits = 0
b.Anchored = false
c.Anchored = false
d.Anchored = false
e.Anchored = false
f.Anchored = false
g.Anchored = false
h.Anchored = false
i.Anchored = false
f.CanCollide = false
g.CanCollide = false
h.CanCollide = false
i.CanCollide = false
end
end
end)
the "local hitsneeded" is setting the hits needed to 16 so that once the tree has been hit 16 tims, all leaves will fall and the logs will become unanchored, but for some reason, the tree falls the first time that i hit the tree. I hit the tree with the "Basic Axe" tool i have in my inventory and it crumples on the first hit instead of sixteenth, can i get some help? thanks :)

3 comments
(I know it isn't LUA but the main script its self (the actual making the tree fall) works in roblox.
http://wiki.roblox.com/index.php?title=Debounce
Thanks for the reply! Do you know how I could set up the script with a ClickDetector maybe?