So I'm making a custom inventory gui and buttons to equip and unequip tools in their inventory (a folder put into the player; not the deafult Backpack) whenever I click the item gui this error shows up: Players.COOLGUY16T.PlayerGui.BackPack.BackpackFrame.Items.Tool.LocalScript:9: attempt to index nil with 'Clone'.
here is the script (its on the client side)
local clicked = false local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function() local character = game.Players.LocalPlayer:FindFirstChild("Character") local humanoid = game.Players.LocalPlayer.Character:FindFirstChild("Humanoid") local tool = player.Inventory:FindFirstChild(script.Parent.Name):Clone() if clicked == false then humanoid:EquipTool(tool) player.HeldItem.Value = tool.Name clicked = true else tool:Destroy() humanoid:UnequipTools() player.HeldItem.Value = "" clicked = false end end)
I dont know what to do please help!
local Thing = player.Inventory:FindFirstChild(script.Parent.Name) local tool = Thing:Clone()