I have a seat in a game, and when the player sits in that seat, this script detects that, GetsPlayerFromCharacter, goes into PlayerGui where the player can change the settings of the color in RGB values, and it is supposed to update the color of a part to match the RGB values in player settings.
However, I’ve been having problems with the color not matching the values in player settings, so I set up print() functions to see where the problem was coming from. I then realized that when I printed the BackgroundColor3 of the item, the print result was in x / 255, so since the BackgroundColor3 value was 255, 255, 255 (white) the print result was 1, 1, 1. For this reason, the part color was changed to black.
Why is this? Why were the results printed in ratios of 255? Is there a way I can go around this in order to print out their real RGB values? (i.e, a print result of 255, 255, 255 so that the right color is used to change the color of the part)
I can use BrickColor in order to change to the correct color, but I was just wondering why this is.
Thanks for all of the help.
local seat = workspace.lead["lead seat"]
seat:GetPropertyChangedSignal("Occupant"):Connect(function()
if seat.Occupant ~= nil then
local occupant = seat.Occupant.Parent
local occupantCharacter = game.Players:GetPlayerFromCharacter(occupant)
print(occupant.ClassName)
print(occupantCharacter.ClassName)
print(occupantCharacter.PlayerGui.settings.Frame.colorIndicator.BackgroundColor3)
script.Parent.Color = Color3.fromRGB(occupantCharacter.PlayerGui.settings.Frame.colorIndicator.BackgroundColor3)
end
end)