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

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

Asked by
6zk8 95
4 years ago

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

Log in to vote
0
Answered by
karlo_tr10 1233 Moderation Voter
4 years ago
Edited 4 years ago

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
0
But wouldn't it be "Lplayer.leaderstats.Points.Value" ? 6zk8 95 — 4y
0
It still doesn't work 6zk8 95 — 4y
0
Try this one I made a mistake while typing karlo_tr10 1233 — 4y
Ad
Log in to vote
-1
Answered by 4 years ago
Edited 4 years ago
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'!

0
and accept the answer, so we both get rep therotatedo 19 — 4y
0
Thanks got mixed with python 6zk8 95 — 4y
0
It does not work 6zk8 95 — 4y
0
oooh, on leaderstats, change 'local leaderstats = Lplayer.leaderstats.Points' to 'local leaderstats = Lplayer.leaderstats.Points.Value' therotatedo 19 — 4y
0
Can you edit the script? 6zk8 95 — 4y

Answer this question