I'm trying to make a table where anything after the initial "cmd" is added after it sees ";". However, my script currently takes the first "cmd" and the command after ";" but doesn't add any others if ";" is stated.

Eg.

"ff/xx;smoke/xx;fire/xx;jump/xx"

Table: ff smoke

Instead I want it to add:

ff smoke fire jump

But i'm not quite sure how to make individual values to pop into the table...

Any ideas?

My code

game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(msg)
local isAdmin = {[14946581] = true, [22] = true, [22] = true}
local CmdsTable = {}
local cmd1 = msg:match("([%w]+)"):lower()
--if isAdmin[Player.UserId] then
table.insert(CmdsTable,cmd1)
local Extra = msg:match("%;([%w]+)")
table.insert(CmdsTable, Extra)
for index = 1, #CmdsTable do
  local cmd = CmdsTable[index]
  print(cmd)
  local Sender = require(script.Functions.Sender)
  Sender.Send(Player,cmd,msg)

end
--end
end)

end)

Thank you.

2 comments

0

I'm not good with regex but that's almost certainly the problem. Try doublechecking your pattern

0

I believe the regex is fine, its just trying to store them each time its found..