Answered by
7 years ago Edited 7 years ago
Okay, let me take you through your own mistakes one step at a time.
2 | script.Parent.Text = "" ..game.Players.LocalPlayer.Data.Level.Value |
A perfectly fine loop, except for two things
1 | 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.
1 | local level = script.Parent |
2 | if level.Text = "5" then |
3 | level.TextColor 3 = ( 255 , 187 , 0 ) |
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
2 | script.Parent.Text = tostring (game.Players.LocalPlayer.Data.Level.Value) |
4 | local level = script.Parent |
5 | if level.Text = = "5" then |
6 | level.TextColor 3 = Color 3. new( 255 , 187 , 0 ) |
However, I would recommend not relying on the text to determine a player's level, it just seems wrong to me.