Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 7 years ago

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

01while wait(1) do
02    script.Parent.Text = tostring(game.Players.LocalPlayer.Data.Level.Value)
03 
04    local level = script.Parent
05 
06    if level.Text <= "9" then
07        level.TextColor3 = Color3.new(157, 78, 0)
08    end
09    if level.Text >= "10" then
10        level.TextColor3 = Color3.new(0, 0, 0)
11    end
12end

1 answer

Log in to vote
0
Answered by
mattscy 3725 Moderation Voter Community Moderator
7 years ago

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.

1Color3.new(0,1,0)

would be bright green, while

1Color3.fromRGB(0,255,0)

would be the same green.

0
Yep That Helped, Thanks your Amazing! 1freshkidz1 12 — 7y
0
also do you mind if i ask another question 1freshkidz1 12 — 7y
0
Ask it as a separate question unless it's directly related mattscy 3725 — 7y
0
Its related to the script 1freshkidz1 12 — 7y
View all comments (2 more)
0
If its simple to ask and doesn't require examples just ask it here mattscy 3725 — 7y
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 1freshkidz1 12 — 7y
Ad

Answer this question