This is a test script:
wchildren = game.Workspace:GetChildren() for a, b in ipairs(wchildren) do game.Workspace.b:Destroy() end
However, the game seems to be looking for an object named b
instead of one with the name of the variable b
.
b is not a valid member of Workspace
Edited: changed code
Problem:
You can't do game.Workspace.b:Destory()
The reason being is that if you do it, the script will think you're trying to delete b, which in this case doesn't exist and will hence an error!
Solution:
If you want to delete "B" then make sure you use b.Name
or something so that the script will not get confused.
If you want to delete everything in the workspace then type the following code:
wchildren = game.Workspace:GetChildren() -- Gets the children of the workspace for a, b in ipairs(wchildren) do b:Destroy() -- destroys everthing in the workspace print "The item has been destroyed!" end
If this helped you, please accept!