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)
There are a few bugs with ur script but ill give u the fixed script and explain them
-- Also always put gears that need to be cloned in replicatedStorage as that is the storage ment for cloning not serverstorage function onTouched(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- u did brackets wrong if player then -- just check if its a player no need to check the backpack local tool = game.ReplicatedStorage.TestTool:Clone() -- clone it here or else itll only clone once globally and only 1 person can get the tool tool.Parent = player:WaitForChild("Backpack") -- use waitforchild here end end script.Parent.Touched:connect(onTouched)
Hope this helped u explain all the bugs with ur script