Hey Guys! I would like to make a user interface that shows a specific players’ leaderstat value
What do you want to achieve? I would like to achieve a user interface that displays a certain users’ leaderstat value in a playerlist. I am currently using Shiroo’s custom playerlist so that’s where you can find the player’s username for defining the value. All I need is a base of a script not an entire script.
What is the issue? I don’t know how to script.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Yes I did but it did not cover what I was looking for.
So insert a script into a textlabel. Say you have a layout like this:
GUI - Frame - TextLabel - Script
If so put this script:
local player = script.Parent.Parent.Parent.Parent.Parent -- amount of parents the children have.
local leaderstats = player:WaitForChild("leaderstats")
local stat = leaderstats:WaitForChild("StatName") -- change StatName to your stat's name
script.Parent.Text = stat.Value
stat.Changed:Connect(function()
script.Parent.Text = stat.Value -- say you wanted the text to be StatName: StatValue. If so put "StatName"..stat.Value and change StatName to whatever you want it to write.
end)
Basically when the game loads in, all the players get the guis from StarterGui and they get put into the player’s playergui. The localized player is the actual player object.
for i,plr in pairs(game.Players:GetChildren())do
if plr then
local pgui = plr.PlayerGui
local leaderboard = pgui:WaitForChild("LeaderboardGui") -- name of leaderboard gui
local player = script.Parent.Parent.Parent.Parent.Parent -- amount of parents the children have.
local leaderstats = plr:WaitForChild("leaderstats")
local stat = leaderstats:WaitForChild("StatName") -- change StatName to your stat's name
script.Parent.Text = stat.Value
stat.Changed:Connect(function()
script.Parent.Text = stat.Value -- say you wanted the text to be StatName: StatValue. If so put "StatName"..stat.Value and change StatName to whatever you want it to write.
end)
end