Roblox: как установить цвет текста с примерами кода

Чтобы установить цвет текста в Roblox, вы можете использовать объект TextLabel и его свойство TextColor3. Вот несколько методов с примерами кода:

Метод 1. Установите цвет, используя значения RGB

local textLabel = Instance.new("TextLabel")
textLabel.Text = "Hello, Roblox!"
textLabel.TextColor3 = Color3.new(1, 0, 0) -- Red color
textLabel.Parent = workspace

Метод 2. Установите цвет, используя предопределенные цвета

local textLabel = Instance.new("TextLabel")
textLabel.Text = "Hello, Roblox!"
textLabel.TextColor3 = BrickColor.new("Bright blue").Color
textLabel.Parent = workspace

Метод 3. Установите цвет с помощью шестнадцатеричных значений

local textLabel = Instance.new("TextLabel")
textLabel.Text = "Hello, Roblox!"
textLabel.TextColor3 = Color3.fromRGB(255, 0, 255) -- Magenta color
textLabel.Parent = workspace

Метод 4. Установите цвет с помощью значений HSL

local textLabel = Instance.new("TextLabel")
textLabel.Text = "Hello, Roblox!"
textLabel.TextColor3 = Color3.fromHSV(200, 1, 1) -- Blue color
textLabel.Parent = workspace

Метод 5. Установите цвет с помощью градиента

local textLabel = Instance.new("TextLabel")
textLabel.Text = "Hello, Roblox!"
textLabel.BackgroundColor3 = Color3.new(1, 1, 1) -- White background
textLabel.BackgroundTransparency = 1 -- Make background transparent
textLabel.TextTransparency = 0.5 -- Make text semi-transparent
textLabel.TextStrokeTransparency = 0 -- Show text stroke
textLabel.TextStrokeColor3 = Color3.new(0, 0, 0) -- Black text stroke
textLabel.Text = "Hello, Roblox!"
textLabel.Parent = workspace