basically i am using a rgb to hex converter and printing it, it works but in script it just does this:

here is my code:
local TextChatService = game:GetService("TextChatService")
local Players = game:GetService("Players")
function toInteger(color)
return math.floor(color.r*255)*256^2+math.floor(color.g*255)*256+math.floor(color.b*255)
end
function toHex(color)
local int = toInteger(color)
local current = int
local final = ""
local hexChar = {
"A", "B", "C", "D", "E", "F"
}
repeat local remainder = current % 16
local char = tostring(remainder)
if remainder >= 10 then
char = hexChar[1 + remainder - 10]
end
current = math.floor(current/16)
final = final..char
until current <= 0
return "#"..string.reverse(final)
end
TextChatService.OnIncomingMessage = function(message: TextChatMessage)
local props = Instance.new("TextChatMessageProperties")
if message.TextSource then
local player = Players:GetPlayerByUserId(message.TextSource.UserId)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 839718134) then
local value = script:WaitForChild("V.I.D")
props.PrefixText = "<font color='"..toHex(value:WaitForChild("Color").Value).."'>["..value.Name.."]</font> " .. message.PrefixText --these break
end
if player.UserId == 869133154 then
local value = script:WaitForChild("OWNER")
props.PrefixText = "<font color='"..toHex(value:WaitForChild("Color").Value).."'>["..value.Name.."]</font> " .. message.PrefixText --these break
end
if player.UserId == 647598508 then
local value = script:WaitForChild("DEVELOPER")
props.PrefixText = "<font color='"..toHex(value:WaitForChild("Color").Value).."'>["..value.Name.."]</font> " .. message.PrefixText --these break
end
end
return props
end