#Help on player backpack

17 messages · Page 1 of 1 (latest)

dawn drum
#
script.Parent.MouseButton1Click:Connect(function(player)
    if player.Backpack:FindFirstChild("Steel") then
        print("Found tool")
    end
end)

tacit siren
dawn drum
tacit siren
#

Here is an error it had "attempt to index nil with 'Backpack"

#

@dawn drum

dawn drum
#

can u send output with lines too

tacit siren
#

like this

#
18:58:26.101  Players.CraftingBlkBelt.PlayerGui.AnvilGui.MainFrame.SteelSword.CraftGui.Craft.CraftScript:2: attempt to index nil with 'Backpack'  -  Client - CraftScript:2
  18:58:26.101  Stack Begin  -  Studio
  18:58:26.101  Script 'Players.CraftingBlkBelt.PlayerGui.AnvilGui.MainFrame.SteelSword.CraftGui.Craft.CraftScript', Line 2  -  Studio - CraftScript:2
  18:58:26.101  Stack End  -  Studio
dawn drum
tacit siren
dawn drum
#

remote events

tacit siren
#

good idea wait

tacit siren
#
script.Parent.MouseButton1Click:Connect(function()
    local player = game.Players.LocalPlayer
    local backpack = player.Backpack

    if backpack and backpack:FindFirstChild("Steel") then
        backpack.Steel:Destroy("Steel")
        print("Steel destroyed")
    end
end)
tacit siren
#

but it only works sometimes it wierd