【问题标题】:Code Is Saying "Attempt to compare number <= Instance"代码说“尝试比较数字 <= 实例”
【发布时间】:2021-10-11 17:36:34
【问题描述】:

它说

Players.ninjafox56.PlayerGui.Shop.ShopGui.LightSide.ChooseSideL:5:尝试比较数字

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)

【问题讨论】:

  • 能否请您详细说明一下,您尝试做什么。

标签: lua roblox


【解决方案1】:

由于Powerleaderstats 中的一个对象,我将假设它是NumberValue

当你说

if Power >= 10000 then

您正在将 NumberValue Instance 与数字进行比较。您没有将存储在 Power 中的数字与数字进行比较,这就是您的错误的来源。要解决此问题,请在比较中使用 NumberValue's Value

if Power.Value >= 10000 then

【讨论】:

  • Ohhhhhh... 这更有意义,谢谢:D
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-10-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-12-09
相关资源
最近更新 更多