Hi. I'm making a Health GUI, with a script that makes the Text Color change whenever the health changes. The code works, but when I try to change the Color3 of the TextLabel, it goes to ridiculously large numbers. The output prints it out how it should be, but the TextLabel just seems to turn it into a different number. Can somebody help, please? Here's the code I'm working with.
function findColor(healthNum)
local newg = healthNum * 2.55
local newr = 255 - newg
return Color3.new(round(newr), round(newg), round(b))
end
game.Players.LocalPlayer.Character.Humanoid.Changed:connect(function(property)
if property ~= "Health" then return end
local char = player.Character
local human = player.Character.Humanoid
if human == nil then return end
local newTextColor = determineColor3(human.Health)
script.Parent.Health_Text.TextColor3 = newTextColor
print(tostring(newTextColor)) -- this results in numbers below/equal to 255, but the color itself is in
-- the ten thousands
end)

1 comment
Also, the rounding function is predefined earlier, it's simply made to round the numbers if they are a large decimal.