Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

help how to make players username display on a gui ?

so im making a profile gui and i want it to display the users username in a Text box when opened but ive searched everywhere and i have no clue how still

1 comment

0

its for the player itself not so other people can see it not a leaderboard

2 answers

Use PlayerAdded so when a player joins, you can use their name to add to the gui - http://wiki.roblox.com/index.php?title=API:Class/Players/PlayerAdded Use for loops to access all the player's gui - http://wiki.roblox.com/index.php?title=Loops&redirect=no#For

Use Instances to make a new text box for the player - http://wiki.roblox.com/index.php?title=Instance_(Data_Structure)

I won't write the whole script it would start off like this:

game.Players.PlayerAdded:connect(function(plr)
	for _, player in pairs(game.Players:GetPlayers())
		local location = player.StarterGui.ScreenGui.ScrollingFrame --This is where you want to add the name
		local textbox = Instance.new("TextLabel")
		textbox.Parent = location
	end
end)

1 comment

0

Hes making a profile gui, not a leaderboard..

What you could do is using a LocalScript. Here is an example

local player = game.Players.LocalPlayer
local gui = game.StarterGui.Gui

game.Players.PlayerAdded:connect(function()
gui.TextLabel = game.Players.LocalPlayer.Name
end)


This discussion is preserved as it was. New answers, comments, and votes are closed.