Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

IF Statements not working properly?

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?

2 comments

0

userId is deprecated use UserId

0

Still doesn't work..

1 answer

✓ Accepted answer

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.

1 comment

0

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.