It's for a basic inventory system but it won't destroy the Folder when you run out of (insert object here) Here's the code
local item = script.Parent.Parent.Item
local quan = script.Parent.Parent.Quantity
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Down:connect(function ()
if item.Value ~= " " then
local obj = game.ReplicatedStorage.ITEMS:FindFirstChild(item.Value):clone()
obj.Parent = player.Backpack
if quan.Value > 0 then
quan.Value = quan.Value - 1
elseif quan.Value <= 0 then
script.Parent.Parent:Destory()
end
end
end)
All I get in the output is "destroy is not a valid member of Folder". But I haven o clue hwy as I never had this error when trying to rid of something before? Any help?

1 comment
An alternative way might be parent = nil