Im trying to test somethings with chatting and tabels but im trying to make this work, can someone help?
admins = {"dreamy67"} game.Players.PlayerAdded:connect(function(player) p.Chatted:connect(function(speaker, message, chatColor) if message == "/myname" and player == admins then Instance.new("Message",PlayerGui).Text = player end end) end)
Basically, there are a few things you messed up on, such as searching for an admin. And also the chatted event could be altered/shortened. Try this:
admins = {"namehere"} game.Players.PlayerAdded:connect(function(p) for i,v in pairs(admins) do if p.Name == v then p.Chatted:connect(function(msg,rec) if msg:lower() == "/myname" then if p.PlayerGui == true then local pg = p.PlayerGui local msg = Instance.new("Message",pg) msg.Text = (p.Name) wait(3) --waits to remove msg:Destroy() end end end) end end end)