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

Make a gui label value a players stat in leaderboard? [closed]

Asked by 5 years ago

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

0
The Problem is that you dont call your function! RedstonecraftHD 25 — 5y
1
Please provide your code within the code block in your question, don't post screenshots, we won't re-type the whole script. Fragmentation123 226 — 5y
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 001Scripter001 0 — 5y

Closed as Non-Descriptive by Goulstem

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?

2 answers

Log in to vote
0
Answered by
metryy 306 Moderation Voter
5 years ago
Edited 5 years ago

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)
0
Were do I put the script? And is it a local script or a script? Darthman522 10 — 5y
0
It would work in a LocalScript, and I would put it in the TextLabel. Mrmonkeyman120 65 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

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