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:

game.Players.PlayerAdded:connect(function(player)
    local leaderstats = Instance.new("IntValue",player)
    leaderstats.Name = "leaderstats"

    local points = Instance.new("NumberValue",leaderstats)
    points.Name = "Points"
    points.Value = 0

    local P = game.StarterGui.Points.Frame.Point
    P.Text = " "..points.Value
end)

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

local Player = game.Players.LocalPlayer
local stats = Player:WaitForChild("leaderstats")
local points = stats:WaitForChild("Points")

function PointChange()
    script.Parent.Text = " "..points.Value
end

points.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
local Player = game.Players.LocalPlayer
local stats = Player:WaitForChild("leaderstats")
local points = stats:WaitForChild("Points")
   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.

function PointChange()
    script.Parent.Text = " "..points.Value
end

points.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