New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Still have questions? Join our Discord server and get real time help.
Log in to vote

TextLabel Leaderstats connection not working, why? HELP!

Asked by 3 months ago
Edited 3 months ago

Hello all!

I've been working on a new Club Game for ROBLOX, and I have been running into some trouble in regards to having the in-game currency, (VCash), show up inside of a text label! I will be providing gyazo images below to better understand my problems with the error code given by ROBLOX Studio!

Essentially, what I want to do is create a GUI that will tell the player their VCash amount inside the GUI where you purchase VCash. I have created the GUI, done the other coding for the GUI(The DeveloperProduct purchase calls, and handler), but I can't seem to figure out this simple trick in ROBLOX.

This has worked for me in previous games, but doesn't seem to now. I realize it may be out dated, but I'd like to know how to fix this problem asap!

Any and all help would be appreciated! Here are my images:

The Error Code(And Int Value in the player) --

The Shop/Where the Label is --

The Code itself that's failing:

while wait(0.1) do
    script.Parent.Text = "V-Cash: ";

2 answers

Log in to vote
Answered by
Thetacah 636 Moderation Voter
3 months ago


VCash may not have loaded into leaderstats yet, so that may be why you're encountering this error.

Try adding an if statement:

while wait(0.1) do
    local leaderstats = game.Players.LocalPlayer:FindFirstChild("leaderstats"):FindFirstChild("VCash")
    if leaderstats then
            script.Parent.Text = "V-Cash: ";


Log in to vote
Answered by 3 months ago

instead of script.parent, try

game.PlayerGui.TextLabel.Text = ""V-Cash: ";"

because sometimes it wont update

Answer this question