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

Why does this change colors?

Asked by 9 years ago

Whenever i try to make a frame i dont get the exact color!

Any help?

local Gui = Instance.new("ScreenGui", Player.PlayerGui)
local Frame = Instance.new("Frame",  Gui)
Frame.BackgroundTransparency = 0.3
Frame.BackgroundColor3 = Color3.new(170, 85, 255)
Frame.BorderSizePixel = 0
Frame.Size = UDim2.new(0, 1298,0, 1298)

0
I am trying this out in Studio, I'm looking into it. TheDeadlyPanther 2460 — 9y
0
I don't think it's possible to fix? I am having the same problem, but try using BrickColor.new("Color name here").Color TheDeadlyPanther 2460 — 9y
0
Try using BrickColor.new("Magenta").Color TheDeadlyPanther 2460 — 9y
0
Oh okay, thanks! UltraUnitMode 419 — 9y
0
If you need any other help, PM EmeraldSlash (my main account) TheDeadlyPanther 2460 — 9y

3 answers

Log in to vote
3
Answered by 9 years ago

When using Color3, all of the 3 values must be a number between 0 and 1, to get the exact color you want you will have to use color/255. This is the code you should use:

local Gui = Instance.new("ScreenGui", Player.PlayerGui)
local Frame = Instance.new("Frame",  Gui)
Frame.BackgroundTransparency = 0.3
Frame.BackgroundColor3 = Color3.new(170/255, 85/255, 255/255)
Frame.BorderSizePixel = 0
Frame.Size = UDim2.new(0, 1298,0, 1298)

I'm guessing it always came up as being white. I think Color3 values used to work as numbers up to 255 but now need to be between 0 and 1. If this worked or helped you, please vote up and accept as answer!

Ad
Log in to vote
1
Answered by 9 years ago

look, idontcare2004 already answwerd your question, but you are using the Size wrong.

Offset is a terrible feature! Use scale.

Frame.Size = UDim2.new(1,  0, 1,  0)

learn how to use scale.

0
Whats the difference? UltraUnitMode 419 — 9y
0
Scale's value depends on the screen size. It makes it universal, and able to be seen on tablets and ipads - which have small screens. With the offset, a tablet may only be able to see half of what a computor sees ConnorXV 5 — 9y
Log in to vote
1
Answered by
Vrakos 109
9 years ago

I usually make a function to help me with Color3 as I feel it saves time and makes the code a whole lot easier.

Here's the function

function color3(r, g, b)
    return Color3.new(r/255, g/255, b/255)
end

local Gui = Instance.new("ScreenGui", Player.PlayerGui)
local Frame = Instance.new("Frame",  Gui)
Frame.BackgroundTransparency = 0.3
Frame.BackgroundColor3 = color3(170,  85,  255)
Frame.BorderSizePixel = 0
Frame.Size = UDim2.new(0,  1298, 0,  1298)

Answer this question