Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[SOLVED]How do I make string.find to find a word in a table?

Asked by 5 years ago
Edited 5 years ago

nevermind I used JSON and it worked

I am making a deprecated table for my admin commands, so when a player tries a deprecated word, a pop up would appear telling him that the command is deprecated, I tried using the script below, but it didn't work.

LocalScript:

local DeprecatedWords = {":return"}
P.Chatted:Connect(function(msg)
   local deprecated = string.find(msg, DeprecatedWords)
   if deprecated then
       local H = Instance.new("Hint")
       H.Parent = game.Workspace
       H.Text = msg.." is deprecated"   
       wait(3)
       H:Destroy()
   end
 end)

And when I try the script above it gives me this error:bad argument #2 to 'find' (string expected, got table)

0
do DeprecatedWords[1] aindev 4 — 5y
0
I used JSON to convert it from a table to string. Thanks, anyways. mixgingengerina10 223 — 5y

Answer this question