Leaderstats Value on Textlabel Script not working

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I want my Leaderstats value to be on my Textlabel

  1. What is the issue? Include screenshots / videos if possible!

It doesn’t seem to work

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I tried searching up but nothing works

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local leaderstats = game.Players.LocalPlayer.Character:WaitForChild("leaderstats").Miles

leaderstats.Changed:Connect(function()  
	script.Parent.Text = leaderstats.Value
end)

Do you see any errors in the output? According to what I see, you may be trying to get the leaderstats from the character (which is not where they are stored usually).

Could this solve the issue?

local miles = game.Players.LocalPlayer.Character:WaitForChild("leaderstats").Miles
local label = script.Parent

label.Text = miles.Value
miles.Changed:Connect(function(value)  
	label.Text = miles.Value
end)

I’m sorry but It didn’t fix the problem

Oops, forgot to edit something out.

local miles = game.Players.LocalPlayer:WaitForChild("leaderstats").Miles
local label = script.Parent

label.Text = miles.Value
miles.Changed:Connect(function(value)  
	label.Text = miles.Value
end)

It works thank you so much!!!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.