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

Why is my Points GUI not working (Points in leaderstats = textlabel) ?

I was trying to do a GUI like in a simulator, the ones where it shows how many coins you have. Here is my script:

local cashHolder = game.StarterGui.StatGUI.Points
local Lplayer = game.Players.LocalPlayer
local leaderstats = Lplayer.leaderstats.Points

while true then do
	local cashHolder.Text = Lplayer.leaderstats
        wait(0.5)
end

Can someone please tell me why it is not working? Thank you!

2 answers

✓ Accepted answer

You shouldn't have local when changing text at line 6 and wrong defining it should be like this

cashHolder.Text = leaderstats.Value

and and you are defining cashholder from startergui, switch first line with

local cashHolder = game.Players.LocalPlayer.PlayerGui:WaitForChild("StatGUI").Points

3 comments

0

But wouldn't it be "Lplayer.leaderstats.Points.Value" ?

0

It still doesn't work

0

Try this one I made a mistake while typing

local cashHolder = game.StarterGui.StatGUI.Points
local Lplayer = game.Players.LocalPlayer
local leaderstats = Lplayer.leaderstats.Points.Value

while true do
    cashHolder.Text = Lplayer.leaderstats
        wait(0.5)
end

The issue: cashHolder is already defined, so don't use local for editing somethings property or interacting with defined variables, don't worry, it's a common mistake. And also it's 'while true do', not 'while true then do'!

5 comments

0

and accept the answer, so we both get rep

0

Thanks got mixed with python

0

It does not work

0

oooh, on leaderstats, change 'local leaderstats = Lplayer.leaderstats.Points' to 'local leaderstats = Lplayer.leaderstats.Points.Value'

0

Can you edit the script?

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