Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I Have some Problems with Color3.new, Color are not changing , Can anyone help me?

Asked by 5 years ago
Edited 5 years ago

Hello , I am making a SB(Script Builder), I made a output GUI And to output things i make new objects on the output GUI with a UIListLayout But the problem is that the colors dont change correctly I made this Note : the desk is PlayerGui wich can be used by my script and the "args" are the arguments , because i use a function (and it is a string)

local TextLabel = Instance.new("TextLabel")
TextLabel.Parent = desk.outPut.Frame.list
TextLabel.BackgroundColor3 = Color3.new(1, 1, 1)
TextLabel.BackgroundTransparency = 1
TextLabel.BorderSizePixel = 0
TextLabel.Position = UDim2.new(0, 0, -0.00471380493, 0)
TextLabel.Size = UDim2.new(999, 999, 0, 18)
TextLabel.Text = args
TextLabel.TextColor3 = Color3.new(29, 0, 255)
TextLabel.TextXAlignment = Enum.TextXAlignment.Left

I get no errors but the color does not change , It stays with the same color of a normal textlabel, I did it with orange color , but it changes to yellow, Why does it happen , How i can fix it?

1 answer

Log in to vote
2
Answered by 5 years ago
Edited 5 years ago

This is not changing because Color3.new takes numbers between 0 and 1, so you'd have to divide each number by 255 to get your colour. If you don't want to do that, use Color3.fromRGB instead.

local TextLabel = Instance.new("TextLabel")
TextLabel.BackgroundColor3 = Color3.new(1, 1, 1) -- this is a white colour. if you want that ok
TextLabel.BackgroundTransparency = 1
TextLabel.BorderSizePixel = 0
TextLabel.Position = UDim2.new(0, 0, -0.00471380493, 0)
TextLabel.Size = UDim2.new(1, 0, 1, 0) -- if you want to fill the screen, do this
TextLabel.Text = args
TextLabel.TextColor3 = Color3.fromRGB(29, 0, 255) -- here 
TextLabel.TextXAlignment = Enum.TextXAlignment.Left
TextLabel.Parent = desk.outPut.Frame.list

I also assigned the Parent last, as you should always do this to up the performance of your game.

0
Thanks maumaumaumaumaumau 98 — 5y
0
. maumaumaumaumaumau 98 — 5y
0
Didn't work maumaumaumaumaumau 98 — 5y
0
I tried fromRGB , and dividing it with / (with Color3.new) maumaumaumaumaumau 98 — 5y
View all comments (2 more)
0
You divide your numbers by 255 with Color3.new. Let's say you wanted 34, 92, 146. You'd do Color3.new(34/255, 92/255, 146/255) User#19524 175 — 5y
0
That is what i did maumaumaumaumaumau 98 — 5y
Ad

Answer this question