Making a tree fall apart not working

I want to make a tree that falls apart upon being touched by a humanoid.

But I can’t seem to figure it out, and I have no idea what the issue is.

I haven’t tried any solutions as because I don’t know what would solve this the code seems fine

local base = script.Parent
local model = base.Parent

local descendants = model:GetDescendants()
local players = game:GetService(“Players”)
local debris = game:GetService(“Debris”)
local debounce = false

base.Touched:Connect(function(hit)
if debounce then
return
end

local character = hit.Parent
local human = character and character:FindFirstChildWhichIsA("Humanoid")

if human then
	debounce = true
	
	
	for _, descendant in pairs(model:GetDescendants()) do
		if descendant:IsA("BasePart") then
			descendant.Anchored = false\
			debris:AddItem(descendant, 20)
		end
	end
end

end)

you left a ‘\’ after descendant.Anchored = false. that will cause the script to error
also idk why you are doing model:GetDescendants() if local descendants = model:GetDescendants() is already declared

2 Likes

Omg, im sorry I didnt notice that im running on zero sleep while coding lol. Thanks for the help

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.