【问题标题】:attempt to compare string and number lua尝试比较字符串和数字lua
【发布时间】:2020-10-19 13:26:15
【问题描述】:
script.Parent.Yes.MouseButton1Click:connect(function()
    if game.Players.LocalPlayer.leaderstats.Stage.Value < 20 and db then
        db = false
        script.Parent.Question.Text = "YOU NEED ATLEAST 20 STAGES TO REBIRTH!"
        wait(3)
        script.Parent.Visible = false
        open = false
        db = true
    elseif db then
        game.ReplicatedStorage.Rebirth:FireServer()
        script.Parent.Visible = false
        open = false
    end
end)

为什么在第 2 行显示一个错误,提示尝试比较字符串和数字?

【问题讨论】:

    标签: lua roblox


    【解决方案1】:

    这意味着 game.Players.LocalPlayer.leaderstats.Stage.Value 是一个字符串。我不知道leaderstats 是如何工作的,但我认为你不小心把它变成了一个字符串而不是一个数字。

    【讨论】:

      猜你喜欢
      • 2021-08-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-18
      • 2016-08-26
      • 2013-05-06
      • 1970-01-01
      相关资源
      最近更新 更多