How to delete folder using script

for i , v in pairs(bag:GetChildren()) do
if v:IsA(“Folder”) then
local summon = v:FindFirstChild(“SummonStand”)
if summon then
v:Destroy()
end
end
end

this didnt work what should i change and this is script not local script

nye just use FindFirstChildWhichIsA(“Folder”)
*edit: Folder not Tool

Maybe this?

game.Workpsace.Folder:Destroy()

the folder is inside player Backpack

how to detect the v.Name

if v.Name = ??

oh j like this?

for i , v in pairs(bag:GetChildren()) do
	if v:IsA(“Folder”) and v:FindFirstChild(“SummonStand”) then
		v:Destroy()
	end
end

To compare a variable to another string:

if v.Name == "NAME" then
v.Name == "Object Name"

image
i want to remove the doppiocrimson

[PLAYER VARIABLE HERE].Backpack[“DoppioCrimson”]:Destroy()

can you tell us what the trigger to delete the folder thingy?

when F is pressed delete the folder

like this Player.Backpack[“DoppioCrimson”]:Destroy()?

yes, if your player variable is “Player”

nyeeeee since the folder parent is a player property why dont you just use local script its client sided e

local Player = game.Players.LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait()

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.F then
		Player.Backpack:FindFirstChild("DoppioCrimson"):Destroy()
	end
end)

ok let me try putting my script in local script

attempt to index nil with ‘Destroy’
Player.Backpack:FindFirstChild(“DoppioCrimson”):Destroy()

You should only attempt to destroy if it exists! Try this instead!

local item = Player.Backpack:FindFirstChild(“DoppioCrimson”)
if item then 
   item:Destroy()
end