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

help how to make players username display on a gui ?

Asked by 7 years ago

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

0
its for the player itself not so other people can see it not a leaderboard Zexennial 0 — 7y

2 answers

Log in to vote
0
Answered by 7 years ago

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)
0
Hes making a profile gui, not a leaderboard.. RubenKan 3615 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

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)


Answer this question