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 6 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

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

Log in to vote
0
Answered by
mattscy 3725 Moderation Voter Community Moderator
6 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.

Color3.new(0,1,0) 

would be bright green, while

Color3.fromRGB(0,255,0)

would be the same green.

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

Answer this question