|
| 19 May 2012 02:22 PM |
Allowed = {"tehepicford", "OtherPlayer"} Online = {}
game.Players.PlayerAdded:conenct(function(player) for i,v in ipairs(Allowed) do if player.Name == v then
table.insert(Online, player.Name) end end
for i,v in ipairs(Online) do [Online].Chatted:conenct(function(msg)
H = Instance.new("Message", Workspace) H.Text = "Worky!"
end) end end)
Im not good at all on .Chatted I would like this fixed. Not a BETTER version, Just a fixed version.
And IF there is only a way to make a new one. Tell me what the other lines mean.
Thanks =D |
|
|
| Report Abuse |
|
|
kools
|
  |
| Joined: 11 Jan 2009 |
| Total Posts: 1659 |
|
|
| 19 May 2012 02:30 PM |
Allowed = {"tehepicford", "OtherPlayer"} Online = {}
game.Players.PlayerAdded:conenct(function(player) for i,v in ipairs(Allowed) do if player.Name == v then
table.insert(Online, player.Name) end end
for i,v in ipairs(Online) do [Online].Chatted:connect(function(msg) --Said connect wrong.
H = Instance.new("Message", Workspace) H.Text = "Worky!"
end) end end)
Im not good at all on .Chatted I would like this fixed. Not a BETTER version, Just a fixed version.
And IF there is only a way to make a new one. Tell me what the other lines mean.
Thanks =D |
|
|
| Report Abuse |
|
|
MrMcAero
|
  |
| Joined: 21 Apr 2012 |
| Total Posts: 671 |
|
|
| 19 May 2012 02:31 PM |
Allowed = {"tehepicford", "OtherPlayer"} Online = {} game.Players.PlayerAdded:conenct(function(player) for i,v in ipairs(Allowed) do if player.Name == v then table.insert(Online, player.Name) end end for i,v in ipairs(Online) do [Online].Chatted:conenct(function(msg) --Miss-spelled? H = Instance.new("Message", Workspace) H.Text = "Worky!" end) end end)
MrMcAero |
|
|
| Report Abuse |
|
|
|
| 19 May 2012 02:59 PM |
Nobody got it... :/ I'm going to re-write it, and explain it with comments line-by-line.
Allowed = { --declare allowed table ["tehepicford"] = true, --index first value ["OtherPlayer"] = true --index second value } --end allowed table's scope Online = {} --declare online table game.Players.PlayerAdded:connect(function(player) --fire PlayerAdded event when players join if Allowed[player.Name] then --if the player's name can be indexed in the Allowed table table.insert(Online, player) --insert the player into the online table end --end if scope for k,v in pairs(Online) do --iterate through online table, creating variables k and v for key and value respectively v.Chatted:connect(function(msg) --fire Chatted event when v chats msg = Instance.new("Message", workspace) --crete Message in Workspace msg.Text = "Worky!" --change the message's Text property to "Worky!" end) end end) |
|
|
| Report Abuse |
|
|