generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Chatted for all players

Previous Thread :: Next Thread 
LordBH is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. ToboboT
Joined: 25 Jun 2011
Total Posts: 2385
23 Sep 2013 04:15 PM
Also add another end, sorry
Report Abuse
dennis96411 is not online. dennis96411
Joined: 06 Mar 2009
Total Posts: 1079
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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image