How do I make a gui that shows your pooints/leaderstats value

This is what I have so far but it only checks the value once

local PlayTime = game.Players.LocalPlayer.leaderstats.timeplayed.Value

local Text = script.Parent

Text.Text = PlayTime

2 Likes

You will have to do a while loop or a changed connect so it updates when the value is changed. So you can do

local PlayTime = game.Players.LocalPlayer.leaderstats.timeplayed.Value

local Text = script.Parent

Text.Text = PlayTime

while wait() do
    Text.Text = PlayTime
end
1 Like

lol that doesnt work no error in the output

1 Like

Try this:
while wait(1) do
script.Parent.Text = game.Players.LocalPlayer.leaderstats.Money.Value
end

2 Likes

Thats a old script i got for a money ui just change some stuff

1 Like

Maybe don’t make the variable for the textbox the same as a property, like Text, which is a property.

local TextBox = script.Parent
1 Like

that really doesnt change anything lol

1 Like

Ohhh try doing

local PlayTime = game.Players.LocalPlayer.leaderstats.timeplayed

local Text = script.Parent

Text.Text = PlayTime

while wait() do
    Text.Text = PlayTime.Value
end
1 Like

I wouldn’t use a loop but rather a changed event

PlayTime:GetPropertyChangedSignal('Value'):Connect(function()
    Text.Text = PlayTime.Value
end)

This code is more efficient

4 Likes

I think you can maybe wrap it with a .Changed:Connect(function()
– your GUI.Value = leaderstats.Value
end)

Nevermind @lluckvy did it too and better.

1 Like

Players.savagebrosyoutube.PlayerGui.ScreenGui.TextLabel.LocalScript:5: attempt to index number with ‘GetPropertyChangedSignal’

1 Like

Can I see your script? I didn’t give you the variables

1 Like

local PlayTime = game.Players.LocalPlayer.leaderstats.timeplayed.Value

local Text = script.Parent

PlayTime:GetPropertyChangedSignal(‘Value’):Connect(function()

Text.Text = PlayTime.Value

end)

1 Like

Remove “Value”, you’re already checking the value through :GetPropertyChangedSignal

4 Likes

thanks for your help. much appreciated

one question how would i make it say Time Played: “number”
instead of just like 40

omg i actually did it by completely guessing lol

To add quotations? Like this

Text.Text = '"'..PlayTime.Value..'"'

i just did Text.Text = "Play Time "… PlayTime.Value

uhh i think the forum changed the 2 dots to three lol

That would also work as well :+1: