|
| 31 Aug 2013 05:12 PM |
| I'm trying to find who chatted "join/alpha" so I can change their team color, but I don't know how to find WHO chatted it. I can get WHAT they chatted though... |
|
|
| Report Abuse |
|
|
| |
|
|
| 31 Aug 2013 05:24 PM |
function onChat(msg, rec) if string.sub(msg,1,5):lower() == "join/" then if string.sub(msg, 6):lower() == "alpha" then -- I need to find who chatted here end end end
function PlayerAdded(newplayer) newplayer.Chatted:connect(onChat) end
game.Players.PlayerAdded:connect(PlayerAdded) |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2013 05:25 PM |
game.Players.PlayerAdded:connect(function(plr) plr.Chatted:connect(function(msg) -- code here -- plr is the person who chatted -- msg is the message that the player posted end) end)
"I'm not Singaporian!" - CeaselessSoul |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2013 05:31 PM |
| seems like you are making game like call of robloxia 5 :P join/axis |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2013 06:18 PM |
function onChatted(message, player) if message:sub(1, 10) == "join/alpha" then player.TeamColor = game.Teams.yourteamhere.TeamColor end end
game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(message) onChatted(message, player) end) end) |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2013 06:20 PM |
| With the function, its notes what the player said and who said it ("message" and "player") |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2013 06:21 PM |
With the function, its notes what the player said and who said it ("message" and "player") |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 31 Aug 2013 06:22 PM |
Fire, as in the other thread. The plr IS FOR THE PLAYER THAT CHATTED.
game.Players.PlayerAdded:connect(function(plr) plr.Chatted:connect(function(msg) if msg:match("^join/") then local team = msg:match("^join/(%w+)") for _,v in pairs(game.Teams:GetTeams()) do if v.Name:match(team) then plr.TeamColor = BrickColor(v.TeamColor) game.Lighting.Sword:Clone().Parent = plr.Backpack end end end end) end) |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 31 Aug 2013 06:23 PM |
| To do the chatted event you must write first what talks, and you use that to find out who talked. |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 31 Aug 2013 06:30 PM |
Or this again, in the other thread
game.Players.PlayerAdded:connect(function(plr) plr.Chatted:connect(function(msg, rec) if msg:sub(1,5):lower() == "join/" then if msg:sub(6):lower() == "alpha" then plr.TeamColor = BrickColor.new("Bright red") game.Lighting.Sword:clone().Parent = plr.Backpack end end end) end) |
|
|
| Report Abuse |
|
|