简体   繁体   中英

Attempt to compare nil <= number

Does anyone know what's happening with my script? The script works fine for other teams but it's just when I try to select 3 of them they all have the same issue being "attempt to compare nil <= number" I've used this same script in some other games as well and they all worked fine. It's just for this one 3 teams won't work.
I can't upload a picture so I'll have to write the line of code where the error is found.

if TeamRequirements[teamn].MinRank <= plr:GetRankInGroup(TeamRequirements[teamn].Group)then

Does anyone know what's happening with my script?

Well obviously you're comparing the nil value TeamRequrements[teamn].MinRank with the number value returned by plr:GetRankInGroup(TeamRequirements[teamn].Group) . This is not allowed in Lua and you certaintly don't expect that value to be nil.

Find out why in this case TeamRequrements[teamn].MinRank is nil and in the other cases you mentioned it is not. We cannot provide more help here as you don't provide the code where TeamRequirements[teamn].MinRank is assigned a value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM