Im trying to make a farm game, and im making a system that randomly spawns plants around some positions, but i need to make it so after some time if the player doesnt collect the plant it will disappear, i made the spawned plant a descendent of the spawn location (i used a part to determinate the location) and i need to detect if a descendent (the plant) of the location where destroyed to just then be able to spawn another plant later again.
I think its important to say that every location has a bool value that i used to another thing, so i need to know if the plant were destroyed not if the part dont have descendents bcs it will always have one
Hello.
There we go:
local part = workspace.Part -- Your desired object goes here.
local function DescendantRemoving()
-- Your descendant removing function goes here.
end
part.DescendantRemoving:Connect(function(descendant)
DescendantRemoving()
end)
You’re welcome. If you ever find this useful, make sure to mark it as the solution
.
1 Like
It would be awesome if you could mark it as the solution
.
1 Like
it worked, i didnt knew about this instance “DescendantRemoving”, TYSM, you saved me.
No problem, have a great one
.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.