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

Checking if someone has applied (TRELLO API)?

Asked by
99names 10
8 years ago

I've made a script that's supposed to check if the person who joined the game has already submitted an application.

It uses Trello Api.

Script:

game.Players.PlayerAdded:connect(function(player)
    for _,List in pairs (Card) do
        local Name,Id = List.name:match("(.) : (.)")
        if Name or Id then
            if Name:lower() == player.Name:lower() or Id == tostring(player.userId) then
                player:Kick("Sorry, you've already taken this test!")
                print("no")
            end
        else
            print("Player is eligible for test")
        end
    end
end)

How can I get this to work?

1 answer

Log in to vote
1
Answered by 8 years ago

Your matches are wrong.

You need to set the pattern to:

List.name:match("(.+) : (.+)")

The + symbol means that it is collecting a string of one or more characters, whereas your script was only looking for one (so it would have got the last letter of the name, and first number of the userId)

Wiki Link

I'd also recommend changing the second to a digit pattern, so:

List.name:match("(.+) : (%d+)")

This means it will only look for (one or more) digits for the ID

Wiki Link

Ad

Answer this question