Why is it ignoring a line?

Issue: image
Original: image
Script:

while true do
	game.Workspace.BowlingSite:Destroy()
	local c1 = game.ServerStorage.Copies.Sites.BowlingSite:Clone()
	c1.Parent = workspace
	wait(120)
end

Why does it not destroy the model? But it still moves on to set the parent?

Workspace hierarchy:
image

Storage Hierarchy:
image

1 Like

Is Bowling site a “Noob” model, or is it that whole group of noobs. It looks like you are destroying the “BowlingSite” but then you instantly clone a new one back into the workspace, which causes nothing to really change.

The Bowling site carries the parts and the noobs, the reason I do this is because every 2 minutes it refreshes, because the goal is to kill the noobs by running over them, so I wouldn’t want an empty area without noobs after it being used.

1 Like

Oh, I get it. Are there any errors?

Maybe try doing wait(0.1) before cloning?

1 Like

None, I’ve looked through my console and server output in game and studio output.

If that line didnt work, which by the way I dont quite know why, you could try looping through the children instead and just destroying them like so:

while true do
    for _, child in ipairs(workspace.BowlingSite:GetChildren()) do
        child:Destroy()
    end
    local c1 = game.ServerStorage.Copies.Sites.BowlingSite:Clone()
    c1.Parent = workspace
    wait(120)
end
2 Likes

You dont need to use GetChildren() because hes removing the model completely

True, this was just a lazy alternative to cheap their way out of that problem instead of seeing why.

Well it still works so cant complain

That won’t work after a while. You will have many models all named “BowlingSite” that are in the workspace. After a couple iterations the game won’t know which model to clear the children of so it might clear the wrong model and the dummies won’t reset. You need to also remove the model itself.

His script would work because it deletes the current bowling site before cloning a new one

It deletes all of the children of the model, but it doesn’t delete the model itself. You need to also just add this:

while true do
    for _, child in ipairs(workspace.BowlingSite:GetChildren()) do
        child:Destroy()
    end
    workspace.BowlingSite:Destroy()
    local c1 = game.ServerStorage.Copies.Sites.BowlingSite:Clone()
    c1.Parent = workspace
    wait(120)
end

Oop I forgot its using GetChildren

If you use Bowlingsite:destroy() you dont even need the getchildren part

Yeah, tbh I don’t know how his code made any difference, destroying the model should work the same as clearing the children. But it is important to also destroy the model that way you don’t have multiple empty models in the workspace.

Oh apparently there was 2 copies in the workspace, I just needed to give someone a solution.

1 Like

Wait so that didn’t work?_____

Here I’ll solution myself instead so it’s more clear.

1 Like

This isn’t going to fix it, but adding these prints could help us. Can you tell us what it prints out. Also, you only have one of these scripts right??

while true do
	local currentsite = game.Workspace.BowlingSite
       currentsite:Destroy()
	local c1 = game.ServerStorage.Copies.Sites.BowlingSite:Clone()
	c1.Parent = workspace
        for i = 1, 100,1 do
                wait()
                print("The blowing alley's parent is: "..currentsire.Parent)
        end
	wait(120)
end