I need help checking if a part in workspace is named “SummonPart” then remove ALL of the parts named summonpart (client-sided)
im making a game that will purposely crash your game cuz im bored rn
while true do
local Part = Instance.new("Part")
Part.Name = "SummonedPart"
Part.Anchored = false
Part.Parent = game.Workspace
Part:Clone().Parent = game.Workspace
Check every Part in the workspace using a “for i,v in pairs()” loop, then check the names from there.
You would do so by creating a for i,v in pairs() loop like @Dasher89798 said to check which parts are named “SummonedPart” in workspace.
You could do the following to check which parts are named so and delete them:
for i,v in pairs(workspace:GetChildren()) do -- getting the children of Workspace
if v.Name == "SummonedPart" then -- Checking if the child's name is "SummonedPart"
v:Destroy() -- Destroying the part
Simply use a
for I, V in pairs() loop and check the Part’s name just like the first reply from this thread said.
for I, V in pairs(workspace:GetDescendants()) do
if V.Name == "SummonedPart" and V:IsA("BasePart") then
It’s really simple, let me explain it with a few lines of code.
for index, value in ipairs(workspace:GetDescendants()) do
if value:IsA("Part") and value.Name == "SummonedPart" then
value:Destroy() -- this works the best because it fetches all the workspace even the models and other parts.
thanks guys, now I can crash my game :DD