Im trying to test somethings with chatting and tabels but im trying to make this work, can someone help?
01 | admins = { "dreamy67" } |
02 |
03 | game.Players.PlayerAdded:connect( function (player) |
04 |
05 | p.Chatted:connect( function (speaker, message, chatColor) |
06 | if message = = "/myname" and player = = admins then |
07 | Instance.new( "Message" ,PlayerGui).Text = player |
08 | end |
09 | end ) |
10 | 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:
01 | admins = { "namehere" } |
02 |
03 | game.Players.PlayerAdded:connect( function (p) |
04 | for i,v in pairs (admins) do |
05 | if p.Name = = v then |
06 | p.Chatted:connect( function (msg,rec) |
07 | if msg:lower() = = "/myname" then |
08 | if p.PlayerGui = = true then |
09 | local pg = p.PlayerGui |
10 | local msg = Instance.new( "Message" ,pg) |
11 | msg.Text = (p.Name) |
12 | wait( 3 ) --waits to remove |
13 | msg:Destroy() |
14 | end |
15 | end |
16 | end ) |
17 | end |
18 | end |
19 | end ) |