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

Text on GUI goes after reset?

Asked by 8 years ago

Ive got code which shows your money on a gui. It changes the gui when you get money but when i reset it everything in the box disappears. Help please

script.Parent.Parent.Parent.Parent.Parent.leaderstats.Level.Changed:connect(function(level)
    wait(0.2)
    script.Parent.Text = level
end)
0
the leaderstats are normally where they are and the script is a normal script inside the textlabel LittleBigDeveloper 245 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago

If you make a the script a 'Local script' you can make your code simple.

while wait() do
    script.Parent.Text = "Level "..game.Players.LocalPlayer.leaderstats.Level.Value
end
0
Thanks, wouldn't this cause lag though? Im paranoid about lag LittleBigDeveloper 245 — 8y
0
I believe there should be a wait in there to avoid it from executing like every milisecond and lagging the f**k out of your game. JJ_B 250 — 8y
1
line 1 idiot ConnorVIII 448 — 8y
Ad
Log in to vote
0
Answered by
JJ_B 250 Moderation Voter
8 years ago

Rather than recording the money value when it changes, I'd recommend using an infinite loop so that it checks every second or so. Here is a script for that:

while true do
level = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Level.Value
script.Parent.Text = level
wait(1)
end
0
mine is better ConnorVIII 448 — 8y
0
alright jesus christ no need to rub it in JJ_B 250 — 8y

Answer this question