In my admin script, I need to find out if the player who is chatting is listed in the table or not. Is there some type of string function that can be used to search a table?
COMMUNITY QUESTION
How to check if a string is in a table?
2 answers
local Admins = {"RedCombee"}
local function CheckIfAdmin(Player)
for _,adminName in pairs(Admins) do
--What this does is makes it so "adminName" is the words in the table Admins
if Player.Name == adminName then --If the player's name is the same as adminName, then:
return true
else --Anything else except if the player's name is the same as adminName
return false
end
end
end
for _,player in pairs(game.Players:GetPlayers()) do
--What this does it makes it so "player" is every player in the game
player.Chatted:connect(function(message)
if CheckIfAdmin(player) == true then --calls the function we made earlier
--CODE HERE :)
end
end)
end
*Heres a TIP not a "answer" but this will get your started on the correct path ;D*
Table={'RedCombee','MessorAdmin','idjwijwdiwjdiwidjwidwidj'};
function G(Plr)
for _,v in pairs(Table) do
print(v)
if v==Plr:lower() or v==Plr.Name:lower() then
print(Plr)
end
G(game.Players.RedCombee)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
I have my own admin script. ;D Gravity Admin(S) Im working on my next generation admin commands! So if you need some help just message @jillmiles1 on ROBLOX.