I'm trying to get the player's name on to a textlabel when they first spawn in.
1 | local player = game.Players.LocalPlayer |
2 | local plrGui = player.PlayerGui.HealthGui.HealthHud.BorderForHealth.TextLabel |
3 |
4 | function PlayerNameGoToHealthbar() |
5 | plrGui.Text = player.Name |
6 | end |
7 |
8 | script.Parent.PlayerAdded:connect(PlayerNameGoToHealthbar) |
This does nothing...Please help?
This works for me
1 | local player = game.Players.LocalPlayer |
2 | local plrGui = player.PlayerGui.HealthGui.HealthHud.BorderForHealth.TextLabel |
3 | wait( 1 ) |
4 | plrGui.Text = player.Name |
I've done these types of TextLabels without the PlayerAdded event before, it seems like that's would you would do but in reality, it's this simple:
1 | local player = game.Players.LocalPlayer |
2 | local plrGui = player.PlayerGui.HealthGui.HealthHud.BorderForHealth:WaitForChild( "TextLabel" ) |
3 |
4 | plrGUI.Text = plr.Name |
Also, make sure you WaitForChild for the TextLabel, and make sure the script itself is a LocalScript!