I need script that checks both backpack and table and prints name of tool that has value of true in backpack and is in backpack.
1 Like
something like this? Change the definition of player if you want it in a server script
local Player = game.Players.LocalPlayer
local Table = {
["Sword"] = true
}
for _, tool in ipairs(Player.Backpack) do
if Table[tool.Name] == true then
print(tool.Name)
end
end
for _, tool in ipairs(Player.Character) do
if tool:IsA("Tool") and Table[tool.Name] == true then
print(tool.Name)
end
end
1 Like
Where should I put it? ServerScriptStorage? Cuz when I put it there it doesnt work
1 Like
PlayerScripts. It needs to be a localscript too
Change the definition of player if you want it in a server script
1 Like
“Backpack is not a valid member of Player “Players.18890miki” - Client - LocalScript:6” Thats is error I got
1 Like