Ad
Log in to vote
0

ScreenGui TextLabel isn't changing TextColor3 values correctly?

Asked by
Troidit 219
1 year ago
Edited 1 year ago

I'm trying to make the text in my ScreenGui glow faintly from different shades of yellow. I thought this script might be able to do that. But when I test in game, it's changing the text color values to RIDICULOUS numbers like 572712,1958123,498281 (just an example)

local txt = script.Parent

while true do
    for i=125,200, 1 do
        print(i) --just to see what's going on
        txt.TextColor3 = Color3.new(224,224,i)
        wait(0.5)   
    end
    for i=200,125, -1 do
        txt.TextColor3 = Color3.new(224,224,i)
        print(i) --just to see what's going on
        wait(.5)
    end
end

am I using an incorrect or terrible method for what I'm trying to achieve. Is there a better way then what I'm doing right now? Because what I'm trying right now isn't working.

1 answer

Log in to vote
1
Answered by
RubenKan 2804 Administrator
1 year ago

This is because color3.new() uses values from 0 to 1. You can either:

Color3.new(224/255,224/255,i/255)

But roblox released a new thing

Color3.fromRGB(244,244,i)

wich will automaticly do this for you.

0
Cool, thanks! Troidit 219 — 1y
Ad

Answer this question



Ad