简体   繁体   English

尝试比较 nil <= number

[英]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.该脚本适用于其他团队,但只是当我尝试 select 3 他们都有相同的问题是“尝试比较 nil <= number”我在其他一些游戏中也使用过相同的脚本,他们都工作正常。 It's just for this one 3 teams won't work.只是为了这一点,3个团队都行不通。
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) .很明显,您正在将 nil 值TeamRequrements[teamn].MinRankplr:GetRankInGroup(TeamRequirements[teamn].Group)返回的数值进行比较。 This is not allowed in Lua and you certaintly don't expect that value to be nil.这在 Lua 中是不允许的,您当然不希望该值为零。

Find out why in this case TeamRequrements[teamn].MinRank is nil and in the other cases you mentioned it is not.找出为什么在这种情况下TeamRequrements[teamn].MinRank为 nil 而在您提到的其他情况下则不是。 We cannot provide more help here as you don't provide the code where TeamRequirements[teamn].MinRank is assigned a value.我们无法在此处提供更多帮助,因为您没有提供为TeamRequirements[teamn].MinRank分配值的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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