I am trying to copy a tool in ReplicatedStorage into the players backpack when they touch the parent of the script which right now is just a normal part but I am getting the error Backpack is not a valid member of MeshPart and I don't know why. Here is the code:
function touch(hit) local copy = game.ReplicatedStorage:FindFirstChild("Tool") copy:Clone() local hum = hit.Parent:FindFirstChild("Humanoid") if hum~=nil then copy.Parent = hit.Backpack print("Tool Given") end end script.Parent.Touched:Connect(touch)
You are trying to copy the tool into the hit itself, instead of player backpack so what you would need to do is
copy.Parent = game.Players:FindFirstChild(hit.Parent.Name).Backpack