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

Make a gui label value a players stat in leaderboard?

Hey,

So I need help I am trying to make a gui label where it will say "Bag - " after bag it will show how much you have in your bag then your max in your bag. I made a leaderstat were I need to connect it to the label. So when you gain 1 in your leaderstat you will gain 1 in the label to!

-My version of trying to make leaderstat the label https://gyazo.com/1e913f7346f479d0e96d511a0ff933eb

If you need any other info pls dm me on discord Little Masta#4713

3 comments

0

The Problem is that you dont call your function!

1

Please provide your code within the code block in your question, don't post screenshots, we won't re-type the whole script.

0

Put a text label in a screen gui then type this in a local script you put in the text label: while wait() do -- Space script.Parent.Text = script.Parent.Parent.Parent.Parent.leaderstats.Coins -- change coins to your currency

2 answers

✓ Accepted answer

You can use the Changed event of the IntValue you have in ReplicatedStorage to call the function everytime the value is changed.

Example:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Player = game:GetService("Players").LocalPlayer
local Bag = Player.leaderstats.Bag
local Storage = ReplicatedStorage:WaitForChild("Storage")

Bag.Changed:Connect(function(newValue) -- The callback function is called everytime the Bag value changes and returns the new value of the Bag
	Player.PlayerGui.Labels.BagLabel.Text = newValue .. "/" .. Storage.Value
end)

2 comments

0

Were do I put the script? And is it a local script or a script?

0

It would work in a LocalScript, and I would put it in the TextLabel.

@metryy is it a local or a normal script? also were do i put it? in the BagLabel? Or SSS? etc

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