I have a crate, and in that crate I've created a script (not localscript) that tries to clone a piece of meat that I have in storage and put it in the backpack. Maybe this doesn't make sense since a piece of meat is not a tool, and I need to create some sort of custom inventory storage for how much meat you have? Anyway, this is the code I've tried:
-- Create a click detector in the part in order to be able to detect clicks. local click_detector = Instance.new('ClickDetector', script.Parent) -- Give the tool to the player when the button is clicked. click_detector.MouseClick:connect(function(player) local newMeat = game.ReplicatedStorage["Meat"]:Clone() newMeat.Parent = player.Backpack print("Added meat") end)
It prints "Added meat" in the debug window when I click the crate, but nothing shows in the backpack.
In order for it to appear in the player's backpack, it needs to be a tool (as DinozCreates said). Maybe you could turn it into a tool where each time the player acquires more meat, a GUI indicates how much meat they have. Also, if the player holds the meat in their hand to eat it, it would probably be best as a tool anyway.