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

How do you make a leaderboard player's Username clone?

Okay, if you don't know what my what my question even mean here is a photo of a gui I made to make a leaderboard gui.

Picture 1: https://gyazo.com/5153ea98d187e982e0799afaf39a450e

Okay, in this picture trying to make a gui Leaderboard.

I made this script here that it finds the username.

local player = game.Players.LocalPlayer
local unitFrame = script.Parent

unitFrame:WaitForChild("PlayerName").Text = player.Name

Here is what it does.

Picture 2: https://gyazo.com/931c47964f8224feaad2f44e3633fb49

But somehow I wanna have it where it clones the name when a new player joins it has their name.

It's like the same thing as the ROBLOX Leaderboard.

So, how do I make it where it makes it just when a new player joins it clones like the same thing as the name. at the top like this picture here.

https://gyazo.com/931c47964f8224feaad2f44e3633fb49

2 answers

✓ Accepted answer

I see you're using a "localscript" but what you want is a "script" that affects all players. And are you asking for something like a table to store every player's name?

local myTable = {}

local function MakeTextBox(playerName)
	--spawn a textbox with the player's name and set coordinates accordingly
end

game.Players.PlayerAdded:Connect(function(Player)
	myTable[Player.UserId] = Player.Name
	MakeTextBox(Player.Name)
end)

local function PrintEverbodysName()
	for _,player in pairs(myTable) do
		print(player)
	end
end

while wait(1) do
	PrintEverbodysName()
end

Or are you asking to programmatically create textboxes and position them? In your equation you'll want a variable for spacings, paddings, size of textboxes, size of frame etc...

4 comments

0

Yes, more like that. It's more like the ROBLOX leaderboard. But I want to be made by my own Gui not the ROBLOX Leaderboard Gui.

0

Even though I really wanna know how to do the points

0

Do what Dalition mentioned but start with no textbox on your leaderboard. Then clone in your first textbox and see where it shows up and change the position accordingly. Same with your second and third. You should start to see a pattern with the positions. THAT is your algorithm, your formula. :)

0

You can also store their score in the same table. myTable[Player.UserId][Score]

Well, you could do a (very) little but of adding, like this:

game.Players.PlayerAdded:connect(function(p)
	textbox = TEXTBOX
	g = textbox:Clone()
	g1 = #textbox.Parent:GetChildren()
	g.Parent = textbox.Parent
	g.Position = UDim2.new(0,g.Position.X.Offset,0,g.Position.Y.Offset*g1)
	g.Text = p.Name
end)

Wrote this in about a minute, forgive me if I made a mistake.

1 comment

0

Umm..it does not seem to work here.

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