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

UserId is correct but it still denies for some reason?

Asked by 1 year ago

The print() prints my UserId (124020867) but then decides to still deny it even tho the UserId is correct and I haven't been able to figure out why

I have tried restarting studio multiple times aswell which didn't fix it

        if Plr.UserId == "124020867" then
            print("Allowed")
            print(Plr.UserId)
        else
            print("Denied")
            print(Plr.UserId)
        end

2 answers

Log in to vote
0
Answered by 1 year ago

Get rid of the quotation marks

0
How did i miss something that small CaptainGreenSeals 23 — 1y
Ad
Log in to vote
0
Answered by 1 year ago

The userid is an integer value, not a string value. Therefore, when checking it, you are checking the integer (124020867), against the string, ("124020867"). This will always return as different from each other datatypes are completely different. To fix this, you need to remove the quotation marks that specify that the number is a string. Then, you will be comparing an integer against an integer, and if it is the correct user, it will print "Allowed."

Answer this question