local WantedColor = instance.New(“StringValue”)
local Gui = script.Parent
WantedColor.Value = 172, 183, 958
Gui.BackgroundColor3 = WantedColor.Value
That doesn’t work cant make a string a color3Value, Please help, Thanks
local WantedColor = instance.New(“StringValue”)
local Gui = script.Parent
WantedColor.Value = 172, 183, 958
Gui.BackgroundColor3 = WantedColor.Value
That doesn’t work cant make a string a color3Value, Please help, Thanks
why are you making a string??
(30charmoment)
Color3 can only change its values using Color3 values. There is a Color3 object value that you can use for this specific reason.
if you wanna use that color value as a string, then do this i guess
script.Parent.Color = Color3.fromRGB(tonumber(WantedColor))
ok crap nvm
Why do you want to use a string? Wouldn’t color3 be much better?
local WantedColor = instance.New("Color3Value")
local Gui = script.Parent
WantedColor.Value = Color3.fromRGB(172, 183, 958)
Gui.BackgroundColor3 = WantedColor.Value
I’m wanted to use a string so the player can change the background color of the ui, And I cant pass through a color3Value through a remote event, the thing with the wanted colors was an example not the problem I’m running into
Why do you need a remote event?
You could use string.split to split the string into 3 sections and convert those to numbers
local colorString = "172, 183, 0" -- user inputted rgb
local colorStringSplitted = string.split(colorString, ",")
local R = tonumber(colorStringSplitted[1])
local G = tonumber(colorStringSplitted[2])
local B = tonumber(colorStringSplitted[3])
if not R or not G or not B then
print("invalid rbg value")
return
end
local color = Color3.fromRGB(R, G, B)
Basically I’m loading player information when the player logs into an account the information I’m loading is the username, password, PriColor, SecColor the information is being stored on the server so I need a remote event to give it to the client.
why would you use a string for changing backgroundcolors though
save a color3 value instead
That would work but the string is one whole line not split up into pieces.
It might be because datastore can’t save color3?
When a player makes a new account its given a SecColor in a table and its string you cant put a Color3Value into a table. The SecColor has a value when its first given to the player
The code above splits the full string into pieces
i save color3 values as 3 seperate number values ← i meant this
Ok Let me try it out and I’ll mark it as a salutation if it works. Thanks
Sure, let me know if there are any errors.
There doesn’t seem to be any error, Thanks for the help I appreciate it .
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.