Help, I have this error that doesn't mean ANYTHING to me. So I have this part that when it ontouched, it is supposed to clone the tool and put it inside the backpack. It doesn't clone it and it just moves the tool instead. Can anybody tell me what is going on?
local tool = game.ServerStorage.TestTool --Change TestTool to whatever you want
local inventory = tool:Clone()
function onTouched(hit)
local player = game.Players:GetPlayerFromCharacter()(hit.Parent)
if player:FindFirstChild("Backpack") then
inventory.Parent = player.Backpack
end
end
script.Parent.Touched:connect(onTouched)

4 comments
Put the hit.Parent inside of the GetPlayerFromCharacter brackets and add a check to see if whatever touched it has a humanoid
How? Also I fixed that the brackets thing.
u have to use :WaitForChild() instead of :FindFirstChild() for some reason
Now I'm getting attempt to index nil with WaitForChild() What kind of garbage is this coding?