isvalid lua error


if( !GAMEMODE.Breen or !GAMEMODE.Breen:IsValid() ) then return end


GM.Breen = {

 { "models/breen.mdl"},

};

I realy dont know what is the problem.

When you try using : on a nil value then it’ll tell you the index / key is not valid as it did in other words.

The way you wrote it, it is GAMEMODE.Breen[ 1 ]

You would also use IsValid( x ) instead of x:IsValid( ) because if x isn’t set, then you won’t get an error. With the code you posted, IsValid isn’t needed… You could use isstring, etc… when comparing but it seems like it’s meant to be a simple var…

I’d recommend using a different table for models…

Thank you :slight_smile: