How would you set up a part that you touch and it clones a tool to your backpack? I have a script that clones it to my backpack but it has errors and I don't know how to set it up. I would greatly appreciate it if someone could help with this!
local Players = game:GetService("Players") local lantern = game.ReplicatedFirst.Lantern
local part = script.Parent
local function onTouched(part)
local player = Players:GetPlayerFromCharacter(part.Parent)
if not player then return end
local backpack = player.Backpack
lantern:Clone().Parent = backpack
end
part.Touched:Connect(onTouched)

2 comments
what are the errors or it just not working?
Ah. You defined part twice.