代码说“尝试比较数字 <= 实例" [英] Code Is Saying "Attempt to compare number <= Instance"
本文介绍了代码说“尝试比较数字 <= 实例"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
它说
Players.ninjafox56.PlayerGui.Shop.ShopGui.LightSide.ChooseSideL:5:尝试比较数字 <= Instance
Players.ninjafox56.PlayerGui.Shop.ShopGui.LightSide.ChooseSideL:5: attempt to compare number <= Instance
Rank = game.Players.LocalPlayer.leaderstats.Rank
Power = game.Players.LocalPlayer.leaderstats.Power
if Power >= 10000 then
Rank.Value = 'Light'
else
script.Parent.Text = 'Not Enough Power'
wait(3)
script.Parent.Text = 'Light Side'
end
end)
推荐答案
由于 Power
是 leaderstats
中的一个对象,我将假设它是一个 NumberValue.
Since Power
is an object inside leaderstats
, I'm going to assume it's a NumberValue.
当你说
if Power >= 10000 then
您正在将 NumberValue Instance 与数字进行比较.您没有将 Power
中存储的数字与数字进行比较,这就是您的错误的来源.要解决此问题,请在对比:
You are comparing the NumberValue Instance against the number. You are not comparing the number stored inside Power
to the number, that's where your error is coming from. To fix this, use the NumberValue's Value in the comparison:
if Power.Value >= 10000 then
这篇关于代码说“尝试比较数字 <= 实例"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文