|
| 09 Jul 2013 12:43 AM |
host = Workspace.rtardbob123 orbowner = {'rtardbob123'}
function onChatted(msg, speaker) for i, v in pairs(orbowner) do if v:lower() == Player.Name.lower() then if msg:sub(1, 4) == '//ff' then Instance.new('ForceField', host) end end end game.Players.Chatted:connect(function(msg) onChatted(msg, player) end) end |
|
|
| Report Abuse |
|
|
|
| 09 Jul 2013 12:44 AM |
| Chatted is an event of Player, not Players. Change your connection line. |
|
|
| Report Abuse |
|
|
ConnorJ14
|
  |
| Joined: 05 Jul 2013 |
| Total Posts: 1025 |
|
|
| 09 Jul 2013 12:45 AM |
| Why did you make orbowner a table instead of just a string? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 09 Jul 2013 12:47 AM |
| @Connor: Because this way you can have multiple people who can use it. |
|
|
| Report Abuse |
|
|
| |
|
ConnorJ14
|
  |
| Joined: 05 Jul 2013 |
| Total Posts: 1025 |
|
|
| 09 Jul 2013 12:47 AM |
| Okay. I'm just asking because I'm learning scripting right now and tables are one of the things I'm studying. |
|
|
| Report Abuse |
|
|
|
| 09 Jul 2013 12:48 AM |
function onChatted(msg, speaker) for i, v in pairs(orbowner) do if v:lower() == Player.Name.lower() then if msg:sub(1, 4) == '//ff' then Instance.new('ForceField', host) end end end game.Player.Chatted:connect(function(msg) onChatted(msg, player) end) end |
|
|
| Report Abuse |
|
|
| |
|
|
| 09 Jul 2013 12:50 AM |
| No, no, no. What you do is first connect Players.PlayerAdded, getting the player in the process. Then you connect Player.Chatted, getting the message. Then you call your script (Although you could combine the connection lines and the function into one, reducing lag and unneeded lines of code) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 09 Jul 2013 12:56 AM |
function onChatted(msg, speaker) for i, v in pairs(orbowner) do if v:lower() == Player.Name.lower() then if msg:sub(1, 4) == '//ff' then Instance.new('ForceField', host) end end end game.Players.PlayerAdded:connect(function(msg)game.Player.Chatted:connect(function(msg) onChatted(msg, player) end) end) end
tbh i hate functions |
|
|
| Report Abuse |
|
|
|
| 09 Jul 2013 12:57 AM |
Change msg in the PlayerAdded event to player, and game.Player to just player
New to events? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|