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

Finding objects in a table?

Asked by
MrFlimsy 345 Moderation Voter
10 years ago

How do I create a function that looks through a specified table for a specified string, and returns true if it finds it? Here is my code:

local admins = { "MrFlimsy", "Xavier12321", "NotAshley", "Interactivity" }

function find(table,string)
    --this is the code I need help with
end

game.Players.PlayerAdded:connect(function(plr)
    plr.Chatted:connect(function(msg)
        if find(admins,plr.Name) then
            --stuff here later
        end
    end
end

I want to make it so only players in my 'admins' list can use the chat commands. Any help would be appreciated.

1 answer

Log in to vote
0
Answered by 10 years ago
Ad

Answer this question