Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Trying to make a Gui that says the players username?

Asked by
Nimbzee 14
5 years ago

Ok, to start things off I am a complete noob at scripting 100% noob, I'm trying to make a text label that says Hello and your username And I have a screen GUI in the Starter gui and a text label inside of the gui. I don't understand much about scripting so this is what I could piece together from my knowledge Because when I test it, nothing happends and the text label does not change(This is in a local script in StarterGui):

1ScreenGui = game.Players.LocalPlayer.PlayerGui.ScreenGui
2ScreenGui.Parent = game.Players.LocalPlayer.PlayerGui
3Textlabel = game.Players.LocalPlayer.Playergui.TextLabel
4Textlabel.Parent = ScreenGui
5 
6Textlabel.Text = "Hello " .. game.Players.LocalPlayer.Name
7 
8ScreenGui.Parent=script.Parent

Thanks!

2 answers

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

It's very simple. All you need to do is reference the player and get their name.

Also, you will want to use a Local Script, not a regular script cause a local script only runs in the player and a regular script only runs on the server. And as long as you have a screen GUI with a textlabel inside, you're all set. *If it's in Starter Gui you don't need to say ScreenGui.Parent = game.Players.LocalPlayer.PlayerGui cause that's where it will automatically go.

1-- This code would be for a local script inside of a text label.
2 
3local player = game.Players.LocalPlayer
4local label =  script.Parent
5 
6label.Text = "Hello "..player.Name
0
thanks! Nimbzee 14 — 5y
0
Youre welcome namespace25 594 — 5y
0
Thanks too, also need it :D Minecrafter09031031 16 — 5y
0
:insert_thumbs_up_here: namespace25 594 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

Simply just do this:

1-- Scripts needs to be a local script.
2-- Local scrip must be inside of textlabel.
3label = script.Parent
4plr = game.Players.LocalPlayer
5name = plr.Name
6label.Text = 'Hello '..name

Answer this question