while true do
local Doors = workspace:GetChildren()
for i = 1, #Doors do
if Doors.Name == "Door" then
Doors:Destroy()
wait(0.3)
end
wait(500)
end
end
I was testing ways to destroy stuff in workspace but it wont destroy my item
while true do
local Doors = workspace:GetChildren()
for i = 1, #Doors do
if Doors.Name == "Door" then
Doors:Destroy()
wait(0.3)
end
wait(500)
end
end
I was testing ways to destroy stuff in workspace but it wont destroy my item
What you're doing wrong is, you're just checking if the Children table's name is 'Door'
here's how you correctly do it :
if doors[i].Name == 'Door' then
doors[i]:Destroy()
end
You can't destroy a table. Doors is a table of parts, you need to call :Destroy() on each door.
while true do
local Doors = workspace:GetChildren()
for i = 1, #Doors do
local door = Doors[i]
if door.Name == "Door" then
door:Destroy()
wait(0.3)
end
wait(500)
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.