【问题标题】:Lua TextLabel Text Change Script ROBLOXLua TextLabel 文本更改脚本 ROBLOX
【发布时间】:2020-06-23 22:02:26
【问题描述】:

我正在开发一款 ROBLOX 游戏并尝试添加一个中场休息。它应该等到回合结束,然后将其文本更改为 Int 倒计时。这是我的脚本:

TeamChange = game.StarterGui.TeamChange
LobbyBar = game.StarterGui.LobbyBar

TimeWaited = 0 

TeamChange.Enabled = false
LobbyBar.TextLabel.Text = "Please Wait for Next Round!"
GameEnded = true



if GameEnded == true then
    TeamChange.Enabled = true
    repeat
        LobbyBar.TextLabel.Text = "Intermission:  " + TimeWaited + " Seconds"
        TimeWaited = TimeWaited + 1
        delay(1)
    until TimeWaited == 10
else
    LobbyBar.TextLabel.Text = "Please Wait for Next Round!"
    TeamChange.Enabled = false
end

此行弹出错误LobbyBar.TextLabel.Text = "Intermission: " + TimeWaited + " Seconds"

此外,如果重要的是 GUI 是 StarterGui 的子级,并且此脚本位于 SeverScriptService 中。

【问题讨论】:

    标签: text lua roblox


    【解决方案1】:

    问题是您试图对文本求和而不是连接它。在 lua 中,要连接文本,语法是 ..。所以你应该使用"Intermission: " .. TimeWaited .. " Seconds",而不是"Intermission: " + TimeWaited + " Seconds"

    【讨论】:

      猜你喜欢
      • 2023-01-26
      • 1970-01-01
      • 2020-07-02
      • 2023-01-26
      • 2016-03-31
      • 1970-01-01
      • 2022-10-20
      • 2022-07-12
      • 2019-10-15
      相关资源
      最近更新 更多