LordBH
|
  |
| Joined: 14 Apr 2011 |
| Total Posts: 108 |
|
|
| 23 Sep 2013 03:35 PM |
How can I make Chatted function's for all players? and if i wanted it to have an exception to work then i'd use if - then - end right? Just asking ,thanks
Player.Chatted:connect(onChat) |
|
|
| Report Abuse |
|
|
ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
|
| 23 Sep 2013 03:43 PM |
| What do you mean? Do you mean when ever a player chats? It fires the chatted connecting line? |
|
|
| Report Abuse |
|
|
adark
|
  |
| Joined: 13 Jan 2008 |
| Total Posts: 6412 |
|
|
| 23 Sep 2013 03:44 PM |
You have to connect it to every player, which is done easiest through use of the PlayerAdded event.
Game.Players.PlayerAdded:connect(function(player)
player.Chatter:connect(function(msg)
--do stuff with player and msg
end)
end)
|
|
|
| Report Abuse |
|
|
ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
|
| 23 Sep 2013 03:46 PM |
^^^^^^
Dats da way. If you want it to do it for all players? I still don't understand what you asked... :? |
|
|
| Report Abuse |
|
|
LordBH
|
  |
| Joined: 14 Apr 2011 |
| Total Posts: 108 |
|
|
| 23 Sep 2013 03:55 PM |
It's simple, theres a function on roblox when you chat, and I want to use it on all players when they say somerhing, for example
"Hi!" ,It has to be exactly "Hi!" unless you do
"or" and keep on going putting or and or and or, thats how admin is made, |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 23 Sep 2013 03:56 PM |
| ^ He wants it so the event is connected to every player. |
|
|
| Report Abuse |
|
|
ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
|
| 23 Sep 2013 04:10 PM |
Well as the guy above said:
game.Players.PlayerAdded:connect(function(player) -- When ever a player enters it will trigger this function -- Whenever this player chats it will trigger this one:
player.Chatted:connect(function(msg) -- the message
if player.Name == "YoloSwagnator" then -- You can also do stuff like :GetRankInGroup(), :IsInGroup(), etc
-- Assuming you want admin:
if string.sub(msg,1,2) == "> " do -- This will trigger whenever a player chats something like this: > Hi -- It will log the message down, now you know it is an admin speaking
if string.sub(msg,3,7) == "msg," then
-- Now if the player chats : > msg, -- It will trigger this
local msgmsg = string.sub(msg,8)
-- Copies the message
local msgw = Instance.new("Message",workspace) msgw.Text = player.Name.." says : "..msgmsg
-- Made it
wait(3)
msgw:Destroy()
--Destroyed it
end
end
end)
end)
-- Hope this helped :D |
|
|
| Report Abuse |
|
|
ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
|
| 23 Sep 2013 04:11 PM |
SORRY:
game.Players.PlayerAdded:connect(function(player) -- When ever a player enters it will trigger this function -- Whenever this player chats it will trigger this one:
player.Chatted:connect(function(msg) -- the message
if player.Name == "YoloSwagnator" then -- You can also do stuff like :GetRankInGroup(), :IsInGroup(), etc
-- Assuming you want admin:
if string.sub(msg,1,2) == "> " then -- This will trigger whenever a player chats something like this: > Hi -- It will log the message down, now you know it is an admin speaking
if string.sub(msg,3,7) == "msg," then
-- Now if the player chats : > msg, -- It will trigger this
local msgmsg = string.sub(msg,8)
-- Copies the message
local msgw = Instance.new("Message",workspace) msgw.Text = player.Name.." says : "..msgmsg
-- Made it
wait(3)
msgw:Destroy()
--Destroyed it
end
end
end)
end) |
|
|
| Report Abuse |
|
|
ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
|
| 23 Sep 2013 04:13 PM |
^^
Don't expect it to work. I am very hurried. |
|
|
| Report Abuse |
|
|
ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
|
| 23 Sep 2013 04:15 PM |
| Also add another end, sorry |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2013 04:48 PM |
Exceptions = {"player1","bannedplayer"}
for _,Player in pairs(game:GetService("Players"):GetPlayers()) do if not table.concat(Exceptions,","):match(Player.Name) then Player.Chatted:connect(function(Message) print(Player.Name .. " chatted: " .. Message) end) end end
|
|
|
| Report Abuse |
|
|
LordBH
|
  |
| Joined: 14 Apr 2011 |
| Total Posts: 108 |
|
|
| 23 Sep 2013 06:28 PM |
I already did it, it doesent have to be that complicated, just
function blahbalhblah()
end
playerenterec:connect(blahbalbhabl) playerchatted:connect(blahblahblah) |
|
|
| Report Abuse |
|
|