How to insert a string on to a table

I have been trying to make an Ai bot that learns.
So when the player chats it would pick a word and put it onto a table
but I get this error — invalid argument #1 to ‘insert’ (table expected, got string)

Here is an example -
local str = script.Parent.Frame.type.Text

local strSplitted = str:split(" ")
script.Parent.MouseButton1Click:Connect(function()
table.insert(s1,strSplitted[math.random(1, #strSplitted)])
end)

That error means that “s1” is a string, not a table. The script you provided doesn’t show what s1 is, so I couldn’t tell you why you think it’s a table when it is really a string.

You need to make a table s1

local s1 = {}

To help you, I would advise you not to write (script.Parent) because it is not clear what this applies to.

local str = Script.Parent.Frame

It Talks about 2 options -

1)Parent is ScreenGui
2) Or Parent is TextButton where Frame is placed.

MouseButton1Click usually doesn’t work on ScreenGui.
Therefore, having more detailed information about the objects you are working on will help solve your problem.

the s1 was a table with all of the already typed in values.

Well it definitely isn’t, otherwise the script wouldn’t error in the way it did. Once agin, there’s no way for me to prove it to you since you didn’t provide the part(s) of the script that defines s1