Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Another Problem With my if then Statement, What am i doing wrong?

I don't know if there's a problem with the colors on Roblox but when I test, instead of the text color being the desired color below (bronze), it's a whole different color, which is 255, 187, 0 or #ffbb00. which is not the color I want. if you want to see a video of it please let me know

while wait(1) do
    script.Parent.Text = tostring(game.Players.LocalPlayer.Data.Level.Value) 

    local level = script.Parent

	if level.Text <= "9" then
		level.TextColor3 = Color3.new(157, 78, 0)
	end
    if level.Text >= "10" then
        level.TextColor3 = Color3.new(0, 0, 0)
    end
end

1 answer

✓ Accepted answer

Instead of using Color3.new you should use Color3.fromRGB, as .new is just for Color3 values on a scale between 0-1 instead of 0-255.

Color3.new(0,1,0) 

would be bright green, while

Color3.fromRGB(0,255,0)

would be the same green.

6 comments

0

Yep That Helped, Thanks your Amazing!

0

also do you mind if i ask another question

0

Ask it as a separate question unless it's directly related

0

Its related to the script

0

If its simple to ask and doesn't require examples just ask it here

0

basically the script says if the players level is less that or equal to 9 then the color will be bronze. Instead when i test, if the players level is 1 then there color is bronze and if there level is greater than 1 then there color is silver which is not supposed to happen

This discussion is preserved as it was. New answers, comments, and votes are closed.