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

Getting players names and setting a text label?

Asked by 5 years ago

Hello, I'm trying to setup a gui type main menu that displays the players username. I cant seem to figure it or find any guides online.

This is what i've got so far.

game.Players.PlayerAdded:Connect(function(plr)  
    script.Parent.Text = plr.Name
end)
0
Is it a server script or local script SurfedZ 36 — 5y
0
At the moment it's a local script that only the player will see OurAuthority 5 — 5y
0
you dont need player added, just define local player in a variable and set player.name to the text of your label Si_SenorTN 25 — 5y
0
That worked perfectly thank you! OurAuthority 5 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

In a local script, and create a StringValue (physically in the workspace).

local players = game:GetService("Players")
local player = game.Players.LocalPlayer

game.Workspace.StringValue.Value=player.Name

Then in a script inside of the GUI, inside of the textlabel:

script.Parent.Text = game.Workspace.StringValue 
Ad

Answer this question