Everything in the script works how I want it to, but when you try to check any players other than yourself, it won't print anything back to the interface? I suspect it has something to do with the local player value that I set to localplayer but I don't know how to fix it.
Thanks, fravls
-- The four commands are open to open the GUI, close to close the GUI, clear to clear the text and !check insertusername to get a list of player's inventory
function invcheck()
wait(2)
game.Players.LocalPlayer.Chatted:Connect(function(msg)
local player = game.Players.LocalPlayer
local inventory = player.Backpack
local items = inventory:GetChildren()
player.PlayerGui.ScreenGui.invtext.title.Text = (player.Name .. " inventory:")
for i= 1,#items do wait(1)
local backpack = {items[i]}
local a = items[1]
local b = items[2]
local c = items[3]
local d = items[4]
local e = items[5]
local f = items[6]
local g = items[7]
local h = items[8]
local j = items[9]
local k = items[10]
local l = items[11]
local m = items[12]
local n = items[13]
local o = items[14]
-- add items in this pattern above then add it into the allitems table down below
local allitems = {a,b,c,d,e,f,g,h,j,k,l,m,n,o}
if msg == ("!check " .. player.name )
then print (allitems[i])
player.PlayerGui.ScreenGui.invtext.Text = (allitems[i].Name)
end
end
end)
end
game.Players.PlayerAdded:Connect(invcheck())
game.Players.LocalPlayer.Chatted:Connect(function(msg)
if msg == "close" then
game.Players.LocalPlayer.PlayerGui.ScreenGui.invtext.Text = " "
game.Players.LocalPlayer.PlayerGui.ScreenGui.invtext.Visible = false
end
end)
game.Players.LocalPlayer.Chatted:Connect(function(msg)
if msg == "open" then
game.Players.LocalPlayer.PlayerGui.ScreenGui.invtext.Visible = true
end
end)
game.Players.LocalPlayer.Chatted:Connect(function(msg)
if msg == "clear"
then game.Players.LocalPlayer.PlayerGui.ScreenGui.invtext.Text = " "
end
end)

3 comments
please ignore my messy code Im sorry im novice
wth
is this egyptian