Wizlyc
|
  |
| Joined: 27 Mar 2015 |
| Total Posts: 312 |
|
|
| 19 Jan 2016 09:57 PM |
| If I want a command to work if a player says "!Shout" + adds their message, I need a statement that determines if they've said "!Shout", in their message. How can I do this? |
|
|
| Report Abuse |
|
|
|
| 19 Jan 2016 10:00 PM |
https://www.youtube.com/watch?v=OvseAKgAIig
read description |
|
|
| Report Abuse |
|
|
Wizlyc
|
  |
| Joined: 27 Mar 2015 |
| Total Posts: 312 |
|
|
| 19 Jan 2016 10:05 PM |
GroupID = 0 Ranks = {"RankName","RankName","RankName"} cmds = {"!Uniform","!Shout"} game.Players.PlayerAdded:connect(function(plr) plr.Chatted:connect(function(msg) local rank = plr:GetRoleInGroup(GroupID) for i = 1,#Ranks do if rank == Ranks[i] then if msg == then -- this is the part im stuck on end end end end) end) |
|
|
| Report Abuse |
|
|
Wizlyc
|
  |
| Joined: 27 Mar 2015 |
| Total Posts: 312 |
|
| |
|
Wizlyc
|
  |
| Joined: 27 Mar 2015 |
| Total Posts: 312 |
|
| |
|
hkep
|
  |
| Joined: 19 Jul 2014 |
| Total Posts: 550 |
|
|
| 19 Jan 2016 10:12 PM |
GroupID = 0 Ranks = {"RankName","RankName","RankName"} -- ok cmds = {"!Uniform","!Shout"} -- these need a function to call with (message) game.Players.PlayerAdded:connect(function(plr) plr.Chatted:connect(function(msg) local rank = plr:GetRoleInGroup(GroupID) for i = 1,#Ranks do if rank == Ranks[i] then -- needs to connect an event (plr.Chatted) and then break if msg == then -- goes in an event end end end end) end)
|
|
|
| Report Abuse |
|
|
hkep
|
  |
| Joined: 19 Jul 2014 |
| Total Posts: 550 |
|
|
| 19 Jan 2016 10:15 PM |
GroupID = 0 Ranks = {"RankName","RankName","RankName"} -- ok cmds = {"!Uniform","!Shout"} -- these need a function to call with (message) game.Players.PlayerAdded:connect(function(plr) local rank = plr:GetRoleInGroup(GroupID) for i = 1,#Ranks do if rank == Ranks[i] then -- needs to connect an event (plr.Chatted) and then break if msg == then -- goes in an event -- string.sub(msg,1,string.len("!Shout")) == "!Shout" end end end end)
my bad im tired rn, and didn't see it was already in an event. Put the event in the if statement |
|
|
| Report Abuse |
|
|
Wizlyc
|
  |
| Joined: 27 Mar 2015 |
| Total Posts: 312 |
|
|
| 19 Jan 2016 10:19 PM |
| Yo all im trying to do is check if the message says "!Shout" + the message they want to shout.. |
|
|
| Report Abuse |
|
|
Wizlyc
|
  |
| Joined: 27 Mar 2015 |
| Total Posts: 312 |
|
| |
|
hkep
|
  |
| Joined: 19 Jul 2014 |
| Total Posts: 550 |
|
|
| 19 Jan 2016 10:42 PM |
local msg = "" local cmd = "!Shout"
local s = string.sub local l = string.len
if cmd == s( msg, 1, l(cmd) ) then local shout = s(msg, l(cmd)+1, l(msg) ) -- so string.sub substrings the msg with the length of cmd plus 1 to the length of msg -- substring is given with a start and end. it returns part of that string end
|
|
|
| Report Abuse |
|
|