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

How to get players and insert them into a GUI, including names and stats?

Asked by 3 years ago

Hello! Im trying to make a custom GUI interface that contains the usernames and stats in a list, but it looks a bit difficult for me.

I have an example here what I want to do. Link from Imgur:

Imgur Example

I really need to get their names and stats, then show the interface to all players. It is just an example.

I have to use lists or tables but I'm not very good at that. I checked this too

https://developer.roblox.com/en-us/api-reference/lua-docs/table https://developer.roblox.com/en-us/articles/Table

I would be grateful if someone has time to explain this well to me. From already thank you very much.

1 answer

Log in to vote
1
Answered by 3 years ago

To insert a player's name on a Gui TextButton, simply insert a local script into that specific text button and write the following;

script.Parent.Text = game.Players.LocalPlayer.Name

To put a specific stat on a Gui that was on a leaderboard, for example, all you simply do is the following; In this example we will use a stat called minutes.

local player = game.Players.LocalPlayer
local minutes = player:WaitForChild("leaderstats"):WaitForChild("Minutes") --change that to whatever you named the leaderstat

script.Parent.Text = minutes.Value

minutes:GetPropertyChangedSignal("Value"):Connect(function()
    script.Parent.Text = minutes.Value
end)
Ad

Answer this question