How would I detect a player's name and have it in a GUI?
So after typing this script, I tested it and realized I needed to add the player name to the script. How would I be able to detect the player name and have it above the rank I have implemented above the player's head.
03 | game.Players.PlayerAdded:connect(onPlayerRespawned) |
04 | function onPlayerRespawned(newPlayer) |
06 | if newPlayer:IsInGroup(groupid) then |
07 | local gui = Instance.new( "BillboardGui" ) |
08 | gui.Parent = newPlayer.Character.Head |
09 | gui.Adornee = newPlayer.Character.Head |
10 | gui.Size = UDim 2. new( 2 , 0 ,. 78 , 0 ) |
11 | gui.StudsOffset = Vector 3. new( 0 , 2 , 0 ) |
12 | local texta = Instance.new( "TextBox" ) |
13 | texta.Size = UDim 2. new( 1 , 0 , 1 , 0 ) |
14 | texta.BackgroundTransparency = 1 |
15 | texta.BackgroundColor 3 = Color 3. new( 0 , 0 , 0 ) |
16 | texta.BorderColor 3 = Color 3. new( 0 , 0 , 0 ) |
17 | texta.TextColor 3 = Color 3. new( 1 , 1 , 1 ) |
18 | texta.BorderSizePixel = 1 |
19 | texta.TextScaled = false |
20 | texta.TextStrokeTransparency = 1 |
21 | texta.FontSize = Enum.FontSize.Size 18 |
22 | texta.Text = ( "- " .. newPlayer:GetRoleInGroup(groupid) .. " -" ) |
25 | if newPlayer:IsInGroup( 1 ) then |
26 | texta.TextColor 3 = Color 3. new( 0 , 0 , 1 ) |
27 | texta.Text = ( "- MP/" .. newPlayer:GetRoleInGroup(groupid) .. " -" ) |
28 | w = game.Lighting.WepsGroup:GetChildren() |
30 | w [ i ] :Clone().Parent = newPlayer.Backpack |
38 | function onPlayerEntered(newPlayer) |
39 | newPlayer.Changed:connect( function (property) |
40 | if (property = = "Character" ) then |
41 | onPlayerRespawned(newPlayer) |
46 | game.Players.PlayerAdded:connect(onPlayerEntered) |