|
| 03 Mar 2011 03:09 PM |
| I've been trying to make some chat commands. I cant seem to do it! I have the chat and the commands but the problem is the connection. How do you make it so any player can say something and then something happens? Just start me a chat script, thats all Im asking for. |
|
|
| Report Abuse |
|
|
AeroMcFly
|
  |
| Joined: 16 Jul 2008 |
| Total Posts: 546 |
|
|
| 03 Mar 2011 03:11 PM |
game.Players.PlayerAdded:connect(p) p.Chatted:connect(function(msg)
end) end) |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2011 03:28 PM |
PLAYER.Chatted:connect(FUNCTION) will return (string message, Instance recipient) |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2011 04:11 PM |
| But how do you get the player...? |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2011 04:15 PM |
You use the PlayerAdded event's argument and sort of convert it into the Chatted event's connection
|
|
|
| Report Abuse |
|
|
|
| 03 Mar 2011 04:17 PM |
| UMG SO ADVANCED! I think I'll just get a chat script off free models and delete everything except connection line and functions and make it into what I want. :l Thanks for trying to help though. FREE COOKIES! *starts raining cookies* |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2011 04:18 PM |
| Its not that advanced actually, it runs this "PlayerAdded" connection function aka "role" and runs that current line when a new player joins the server. |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2011 04:22 PM |
function onChatted(msg,speaker) if msg=="reset" then if speaker.Character~=nil then speaker.Character:BreakJoints() end end end
function Connect(player) player.Chatted:connect(function(msg) onChatted(msg,player) end
function onPlayerEntered(user) Connect(user) end
game.Players.PlayerAdded:connect(onPlayerEntered)
Send me a PM about what you dont get or make a post. |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2011 04:25 PM |
Yes. It was a joke with the advanced thing. But I found something to start a chat script in the wiki, woot. Here it is:
function onChatted(player, message) print(player .. " said " .. message) end
function onPlayerAdded(player) player.Chatted:connect(function(message, recipient) onChatted(player, message) end) end
game.Players.PlayerAdded:connect(onPlayerAdded)
|
|
|
| Report Abuse |
|
|
AeroMcFly
|
  |
| Joined: 16 Jul 2008 |
| Total Posts: 546 |
|
| |
|
| |
|
| |
|
|
| 08 Sep 2011 03:52 PM |
Heheh
Can u give me a caik??? |
|
|
| Report Abuse |
|
|
| |
|
| |
|