I'm new to the whole development aspect of Roblox and I've been working on improving my skills as a rookie developer. I've been working on a game involving cutting down trees to get wood and I wanted to make it so that the wood you just collected by chopping down a tree is in your inventory and you're able to hold it. This means that it will have to be a tool and is needed to be a child of the StarterPack.
I've tried various different things and I've come to a conclusion that Instancing a tool would be the best way to go (just because it's going to be a block of wood and should be easy to model via code) I saw on the web that a tool needs to have a child named "Handle" to be able to be held so, here's my code:
local pines = game.Workspace.Game.LumberForest.LumberPines
-- LumberForest and LumberPines are the folders, LumberForest is the forest and LumberPines is a folder full of Pine Trees
local pine = pines:FindFirstChild(pines.PineTree)
script.Parent.MouseClick:Connect(function()
game.Workspace.Game.LumberForest.LumberPines.PineTree:Destroy()
local wood = Instance.new("Tool")
wood.Parent = game.StarterPack
wood.Name = "Pine"
local handle = Instance.new("Part")
handle.Parent = wood
handle.Name = "Handle"
handle.Material = "Wood"
end)
I've been debugging this for quite a while and I still can't seem to figure it out. If there's an easy solution to this, please let me know (and go easy on me, I'm new)

1 comment
What exactly is the problem? Also, you should set the parent property last ( https://devforum.roblox.com/t/psa-dont-use-instance-new-with-parent-argument/30296 )