#Help on player backpack
17 messages · Page 1 of 1 (latest)
thanks I got it to work, but now Im having trouble destorying the tool after it prints
try this
script.Parent.MouseButton1Click:Connect(function(player)
if player.Backpack:FindFirstChild("Steel") then
local tool = player.Backpack:FindFirstChild("Steel")
tool:Destroy()
print("Found tool")
end
end)
idk why it wont work
can u send output with lines too
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
oh you cant remove the tool from hte client
so what would I do?
remote events
good idea wait
this works but sometimes
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)
yea that should work
but it only works sometimes it wierd