✓ Accepted answer
Okay, let me take you through your own mistakes one step at a time.
while wait(1) do
script.Parent.Text = ""..game.Players.LocalPlayer.Data.Level.Value
end
A perfectly fine loop, except for two things
script.Parent.Text = ""..game.Players.LocalPlayer.Data.Level.Value
that "".. is entirely useless. I'm not sure what you were trying to do there, but if you were trying to turn .Value into a string, try tostring().
Secondly, your loop runs forever. The other parts of your code will never execute because your loop just never ends.
local level = script.Parent
if level.Text = "5" then
level.TextColor3 = (255, 187, 0)
end
the == operator will check if something is the same as another thing, the equals sign will set a value to something, you actually use it for just that purpose immediately above and below the flawed if statement.
As for the color changing part, you need to use Color3.new(255,187,0) to actually change the color, leaving it as is will throw an error, it will also tell you something is wrong just in the text editor.
Some fixed code would look something like this
while wait(1) do
script.Parent.Text = tostring(game.Players.LocalPlayer.Data.Level.Value)
local level = script.Parent
if level.Text == "5" then
level.TextColor3 = Color3.new(255,187,0)
end
end
However, I would recommend not relying on the text to determine a player's level, it just seems wrong to me.
2 comments
It’s actually Color3.fromRGB that needs to be used and not Color3.new. You should edit your answer. :P
You are actually the best, it worked, thank you so much! also the text is displayed on the players exp bar.