I have a problem in my script where it only clones the tool itself and the handle, but doesn’t clone any other children of the tool.
I don’t know if I am doing something wrong or that is not a thing. Is there any other way of doing this?
My current code:
if Answer == true then
if RepliStorage.ItemAssets:FindFirstChild(selectedItem) then
local toolRep = RepliStorage.ItemAssets:FindFirstChild(selectedItem)
if toolRep then
local Clonedtool = toolRep:Clone()
Clonedtool.Parent = plr.Backpack
Clonedtool.Name = selectedItem
Item = selectedItem
ItemCost = selectedCost
local Handle = Clonedtool:WaitForChild("Handle")
local Children = {}
for _, child in pairs(Clonedtool:GetDescendants()) do
if child ~= Handle then
table.insert(Children, child)
end
end
print(Children)
if Clonedtool then
for _, child in Clonedtool:GetChildren() do
if child.Name ~= "Handle" then
local clonedChild = child:Clone()
clonedChild.Parent = Clonedtool
end
end
end
end
Also where it says print(Children) it did print the children of the tool, but after that it doesn’t :Clone the children.
If i make the parent of the children, plr.Backpack it does get cloned but when I move it to the tool, I do not see any of the parts (the children of the tool) apart from the handle.
Also would it be easier to have a picture of the tool, instead of multiple parts in a tool. As used in Roblox Disch.
If you cloned a tool you know its children will also be cloned? So if thats you problem. Also theres no reason to set its name to the selecteditem because all of the properties get cloned too
Also funnly im also making a virson of disch for my yt channel where you search in dumpsters.