I'm trying to make a script so when i type "-get" followed by a string in the table (for example "-get blue") it would print "worked" like it is supposed to, how would i make it check if the argument matches a string in the table?
list = {"yellow", "blue"}
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
local msg = msg:lower()
if string.sub(msg,1,5) == "-get" and string.sub(msg,6) == list
then print('worked') else print('didnt work')
end
end)
end)

1 comment
Try not to use the same variable for the arguments that were passed. So change the variable msg, different from the argument msg.