so basically i want an axe to hit a tree(working), then a value attached to the tree goes += 1, then once that value hits 3, i want the tree to become uncollideable and play a sound and ish. that isnt working and i have no idea why.
local wood = script.Parent
local leaves = wood.Parent.leaves
local hits = script.Parent.Hits
local hitsValue = hits.Value
local sound1 = wood.Sound1
local sounds = {sound1}
hits.Changed:Connect(function()
print("checking hits")
if hitsValue > 3 then
print("--hits larger than 3--")
sounds[math.random(1, #sounds)]:Play()
wood.Anchored = false
leaves.Anchored = false
wait(2)
wood.CanCollide = false
leaves.CanCollide = false
else
print("uhhh")
end
end)
(basically just checks whenever the value is updated (works perfectly) and checks if its larger than 3)