【问题标题】:Create a textLabel in Roblox using only code仅使用代码在 Roblox 中创建 textLabel
【发布时间】:2020-05-09 05:01:09
【问题描述】:

正如标题所示,我正在考虑仅使用代码为 Roblox 中的玩家 Gui 创建一个标签。在 StarterGui 文件夹下,我有一个 ScreenGui,作为 ScreenGui 的子项,我有一个本地脚本,代码如下:

local ScreenGui = script.Parent
local label = Instance.new("TextLabel", ScreenGui)
label.Size = UDim2.new({0, 200},{0, 100})
label.Text = "label"
label.TextColor3 = Color3.new (0,0,0)
label.TextSize = 36
label.Font =  "Arial"
label.TextScaled = true

我很确定我现在应该看到一个带有“标签”一词的标签,但什么也没有。我错过了什么?

【问题讨论】:

    标签: user-interface label roblox textlabel


    【解决方案1】:

    说的那一行 label.Size = UDim2.new({0, 200},{0, 100})

    应该是 label.Size = UDim2.new(0, 200, 0, 100)

    这是因为 UDim2.new 接受 4 个参数,而不是 2 个数组。

    希望我能帮上忙!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-23
      • 2014-05-26
      • 1970-01-01
      • 2015-04-06
      • 1970-01-01
      • 2023-01-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多