You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Have a tree spawn coconuts after a while they fall then despawn after a bit.
-
What is the issue? Infinite yield possible on ‘BigCoconut:WaitForChild(“Handle”)’
-
What solutions have you tried so far? Devloper hub, other devs topics, chat gpt, my own will. I havent looked at my old code that was jankie but works. I also tried to force studio to wait for the child with task.wait(CloneBigOne.Handle) and CloneMediumOne:WaitForChild(“Handle”)
local Cs = script.Parent.Parent:FindFirstChild("CoconutSpawns")
local function MuliClone()
local CloneBigOne = Cs.BigCoconut:Clone()
CloneBigOne.Handle.Anchored = true
CloneBigOne.Handle.CanCollide = true
CloneBigOne.Handle.CanTouch = true
CloneBigOne.Handle.Transparency = 0
CloneBigOne.Handle.Parent = workspace["Palm Tree"].Clones
local CloneMediumOne = Cs.MediumCoconut:Clone()
CloneMediumOne.Handle.Anchored = true
CloneMediumOne.Handle.CanCollide = true
CloneMediumOne.Handle.CanTouch = true
CloneMediumOne.Handle.Transparency = 0
CloneMediumOne.Handle.Parent = workspace["Palm Tree"].Clones
local CloneSmallOne = Cs.SmallCoconut:Clone()
CloneSmallOne.Handle.Anchored = true
CloneSmallOne.Handle.CanCollide = true
CloneSmallOne.Handle.CanTouch = true
CloneSmallOne.Handle.Transparency = 0
CloneSmallOne.Handle.Parent = workspace["Palm Tree"].Clones
wait(10)
CloneBigOne:WaitForChild("Handle")
task.wait(CloneBigOne.Handle)
CloneBigOne.Handle.Anchored = false
CloneMediumOne:WaitForChild("Handle")
task.wait(CloneMediumOne.Handle)
CloneMediumOne.Handle.Anchored = false
CloneSmallOne:WaitForChild("Handle")
task.wait(CloneSmallOne.Handle)
CloneSmallOne.Handle.Anchored = false
end
while true do
wait(5)
local result = math.random(1, 2)
if result == 1 then
MuliClone()
end
end