I have a leaderstats which is working perfectly. I am trying to transfer the data to a GUI Leaderboard. It is a “King of the hill” kind of game. The Hillpoints are updating but I am not sure how to get that live update working in the GUI. It just stays “0”.
This is the leaderstats script:
local function addRowToPlayers(player)
local frm = ReplicatedStorage:WaitForChild("PlayerRow")
for _, p in pairs(game.Players:GetChildren()) do
local pGui = p:WaitForChild("PlayerGui")
local sGui = pGui:WaitForChild("LeaderBoardGUI")
local cloneFrm = frm:Clone()
cloneFrm.Name = player.Name
cloneFrm.PlayerLBL.Text =player.Name
cloneFrm.HillLBL.Text = 0
cloneFrm.Parent = sGui:WaitForChild("LeaderFrame")
end
local cloneFrm = frm:Clone()
cloneFrm.Name = player.Name
cloneFrm.PlayerLBL.Text =player.Name
cloneFrm.HillLBL.Text = 0
cloneFrm.Parent = screenGUI:WaitForChild("LeaderFrame")
end
This is the code which updates the Hillpoints:
for _ , v in pairs (game.Players:GetPlayers()) do
local HillPoints = v:FindFirstChild("leaderstats").HillPoints
if v.InHill.Value == true then
HillPoints.Value = HillPoints.Value + 1
end
v.InHill.Value = false
end
How do I send that Hillpoints value to the GUI? I tried simply referencing the LocalPlayer.leaderstats.Hillpoints.value but it just tells me that I am trying to connect a nill value. What am I doing wrong?
It is run continuously while the player is standing on the hill. It stops as soon as he gets off. It is working in the normal leaderstats, the problem seems to be that it is not picking up that value in the Leaderboard GUI
It is the result of mixing three different tutorials, and at some point getting lost and messing it up completely. I guess I will have to rethink the whole process.