Table value comparison isn't working

    for i,v in pairs(Data)do
            print(v["Arrestee"])
            if v["Arrestee"] == RequestingPerson then
                print("its him")
            else
                print("not him")
            end
        end

When I do lua print(v["Arrestee"]) it prints the correct userID, when I try to compare it with if v["Arrestee"] == RequestingPerson then, it doesnt run, it insteads goes to the else. Even though requestingPerson and the print(v[“Arrestee”]) are the same, its acting as if it is not.

did u check that RequestingPerson is a number value, not an instance

1 Like

Yes I’m sure it is as when I set it in the table I’m simply putting UserId

It is RequestingPerson located in the script or it is a value?

Because if print(v[“Arrestee”]) show you correct UserId in output then

v[“Arrestee”] (UserId) == RequestingPerson (Correct Numbers?)

It must work, show me local RequestingPerson.

Requesting value is a number sent from a event as a parameter

One was a “string”, and another was a “number”, I used
tostring() or tonumber()
to change them to match which I could then check to see if they matched.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.