I'm trying to display a players username on TextLable in ScreenGUI but...
I've tried many scripts including this one:
local player = game.Players.LocalPlayer game.StarterGui.YourHealthBar.Frame.TextLabel.Text = print(player)
and tried looking up the answers to other people that have asked the same question but I still couldn't get it to work.
Hello. :}
Okay, well, first off, print("Hello world!") is used to print out things in the console (usually to find bugs in your code). You cannot set the text of the TextLabel to a console output using print.
As with all things in the game, they have a name. To get the name, which is a string value, you would use something like this:
local player = game.Players.LocalPlayer local name = player.Name
Simple, right? So, to change the name of the text, you would use this code:
local player = game.Players.LocalPlayer game.StarterGui.YourHealthBar.Frame.TextLabel.Text = player.Name
Hope this helped. :}