SelectionBox SurfaceColor3 not working

I am trying to set the surfacecolor3 of a selectionBox and having a problem.
I have used debug to stop after the line of code that does the setting and checking the selectionbox in the explorer and the color is not correct.
I have no idea why this is happening.
It works in other calls to the function.
The line of code is
box.SurfaceColor3 = Color3.new(color)
and color contains the string “White”

2 Likes

could i see the whole script ?

a color3 is not a brickcolor
you need to do something in the likes of Color3.new(1,1,1) (for rgb values do Color3.fromRGB(255,255,255) and for hex Color3.fromHex(“#FFF”))
you use strings for brick colors such as BrickColor.new(“Institutional White”)

judging from the documentation though, selection box uses color3 so the easiest way is doing

box.SurfaceColor3 = Color3.new(1, 1, 1)

or using hex if you need to use a string for whatever reason you have

box.SurfaceColor3 =Color3.fromHex("#FFF")

if you need to use the color variable (assuming you have to use a string) do

color = "#FFF"
box.SurfaceColor3 =Color3.fromHex(color)

here are some links that might help you further

2 Likes

Thanks I forgot about the change from color to color3.
I will change the code to translate the colors I have in strings (where they dont work) to use the Hex version…

I fixed the problem I was seeing in the explorer where the surfacecolor3 was not changing by using BrickColor.new(color).Color which converts the brickcolor from the string I am using to a Color3

Now I see that the color3 in the selectionbox does not change to match the surfacecolor3.

Is there another setting I have to set to make that work?

2 Likes

The Color3 is only changed via explorer and is the box surround which by default is a bluish color.
Changing the SurfaceTransparency, from 1 to 0.5, for example shows the colour I was expecting Color3 to be set via SurfaceColor3.
My mistake.

1 Like

sorry for the late reply but yeah, basically what you said

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.