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

IF Statements not working properly?

Asked by 7 years ago

Basically, I'm making a Trello ban list using the API.

for i,v in pairs(ap:GetCardsInList(BlackLIST)) do
if v.name:match('(.*):(.*)') then
local Name,ID=v.name:match('(.*):(.*)')
print("Ban List: "..Name,ID)
if ID == Plr.userId then
warn("Blacklisted User: "..Plr.Name.." | TERMINATED")
game.ReplicatedStorage.TrelloDataRequest:FireClient(Plr,"BlackLIST")
BansList = true
end
end
end

Everything works, except "if ID == Plr.userId then"

The ID is the exact same as the Plr.userId - but for some reason it won't work.

Help?

0
userId is deprecated use UserId farrizbb 465 — 7y
0
Still doesn't work.. CherryLeaves 32 — 7y

1 answer

Log in to vote
0
Answered by
jotslo 273 Moderation Voter
7 years ago

Because ID is a string type, and Plr.userId is a number type, you need to ensure that they're both the same type, otherwise they are not considered equal.

if tostring(ID) == tostring(Plr.userId) then

The code above should work correctly.

0
Thanks! CherryLeaves 32 — 7y
Ad

Answer this question