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

Why after death points leaderboard gui got reset?

Asked by 9 years ago

Hello, I have problem with points leaderboard gui, after death my gui show me 0, but still got all points. Here is main script from workspace:

01game.Players.PlayerAdded:connect(function(player)
02    local leaderstats = Instance.new("IntValue",player)
03    leaderstats.Name = "leaderstats"
04 
05    local points = Instance.new("NumberValue",leaderstats)
06    points.Name = "Points"
07    points.Value = 0
08 
09    local P = game.StarterGui.Points.Frame.Point
10    P.Text = " "..points.Value
11end)

Here is script from StarterGUI>Points>Frame>Point :

1local Player = game.Players.LocalPlayer
2local stats = Player:WaitForChild("leaderstats")
3local points = stats:WaitForChild("Points")
4 
5function PointChange()
6    script.Parent.Text = " "..points.Value
7end
8 
9points.Changed:connect(PointChange)

Maybe i need add line somewhere, but i don't know where, becouse im beginner scripter. Here is GIF with my problem: http://gyazo.com/c99252551e5a5bf76dee3c3b0829b9a6

0
Every time a player dies, the startergui is re-cloned into their playergui. HungryJaffer 1246 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago
01local Player = game.Players.LocalPlayer
02local stats = Player:WaitForChild("leaderstats")
03local points = stats:WaitForChild("Points")
04   script.Parent.Text = " "..points.Value -- Every time a player dies, the startergui is re-added to their playergui. Therefore, if this is added, when it is re-added to their playergui, it will display their current points instead of 0.
05 
06function PointChange()
07    script.Parent.Text = " "..points.Value
08end
09 
10points.Changed:connect(PointChange)
0
But script in the Gui is Local Script. DevKarolus1 70 — 9y
0
okay, let me play around with the script. HungryJaffer 1246 — 9y
0
So you tried something? DevKarolus1 70 — 9y
0
Thanks for help. DevKarolus1 70 — 9y
Ad

Answer this question