For some reason this script runs what’s in the if statement once, but not again even if there are no children inside of it.
RS = game:GetService("ReplicatedStorage")
part = script.Parent
while wait(0.001) do
if not part:FindFirstChild(part:GetAttribute("ForageableItem")) then
local cloner = RS.Forageables:FindFirstChild(part:GetAttribute("ForageableItem")):Clone()
cloner.Parent = part
cloner:SetPrimaryPartCFrame(part.CFrame)
end
end
It is the same name, it does work once. No errors in output, I have no idea what is wrong. I did some testing and it seems for some reason it doesn’t detect the change when the forageable is removed from the part’s children.
Sure, Im just testing how to handle spawning forageables in my world, it should respawn immediately but instead doesn’t respawn at all. I did do some testing with the print statements, it does not detect that the child forageable had been removed
Okay, can you try something for me? after you clone it originally, in the same if statement that checks if it doesn’t exist, can you wait a few seconds, and do cloner:Destroy() and then see if it re-appears by itself?
Well, that cloner:Destroy() function makes it delete itself without you pressing e on it, but did waiting longer fix your entire issue without the Destroy() function?