local Words_To_Kick_Player = {
["kick me"] = true; -- it's essential you keep the messages in this format when adding a new one, with the brackets and = true, it helps identify the message thats being passed as a parameter!
};
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(msg)
local input = string.lower(msg);
if Words_To_Kick_Player[input] then
Player:Kick("Bye-Bye!");
end
end)
end)
hope this helps!
(also this is my first post, hope this helps !)
edit: if you’re looking to segment text FROM a players text, you could try and do this too
local Words_To_Kick_Player = {
"kick me";
};
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(msg)
local input = string.lower(msg);
for k,v in next, (Words_To_Kick_Player) do
if input:find(v) then
Player:Kick("Bye!!!");
end
end
end)
end)
Instead of using the desired words as indexes, wouldn’t it be more efficient to just use them as values? I don’t see a purpose for indexing each words as true within the table.