#Need help setting up Kill Counter
27 messages · Page 1 of 1 (latest)
** You are now Level 2! **
you mean ur leaderstats are going up but the gui isnt?
exactly
i want to increase the "counter" in my GUI instead of the "normal" one on the right side
you'd need to run a loop inside the textlabel that says while wait() do script.Parent.Text = game.Players.LocalPlayer.leaderstats.Kills.Value end
inside the Gui or the death script?
i am currently running this
local killsLabel = game.StarterGui.KillsLabel.Kills
local function updateKills(player)
local kills = player:FindFirstChild("leaderstats") and player.leaderstats.Kills
if kills then
killsLabel.Text = "Kills: " .. kills.Value
end
end
game.Players.PlayerAdded:Connect(function(player)
updateKills(player)
player:GetPropertyChangedSignal("leaderstats"):Connect(function()
updateKills(player)
end)
end)
for _, player in ipairs(game.Players:GetPlayers()) do
updateKills(player)
end
yeah maybe try player.leaderstats:GetPropertyChangedSignal("Kills")
u mean in this line?
player:GetPropertyChangedSignal("leaderstats"):Connect(function()
updateKills(player)
yea
if that doesnt work honestly just delete the script and do what i first said
cuz that 40 line script is doable in like 3 lines
so editing " player:GetPropertyChangedSignal("leaderstats"):Connect(function()
updateKills(player)" this
to
player.leaderstats:GetPropertyChangedSignal("Kills")
updateKills(player)
yes
checking
nope :/
still my Gui at 0 and regular interface at +1
local killsLabel = game.StarterGui.KillsLabel.Kills
local function updateKills(player)
local kills = player:FindFirstChild("leaderstats") and player.leaderstats.Kills
if kills then
killsLabel.Text = "Kills: " .. kills.Value
end
end
game.Players.PlayerAdded:Connect(function(player)
updateKills(player)
player:GetPropertyChangedSignal("leaderstats"):Connect(function()
updateKills(player)
end)
end)
for _, player in ipairs(game.Players:GetPlayers()) do
updateKills(player)
end
while true do
wait(1)
for _, player in ipairs(game.Players:GetPlayers()) do
updateKills(player)
end
end
hope i set the "loop" you talked before right but its still not working like this
while wait() do script.Parent.Text = game.Players.LocalPlayer.leaderstats.Kills.Value
end
delete all that jargon and just put this local script inside of the textlabel
it will update the text
fixed thanks a lot !! ❤️
Yeah you're welcome
i spend almost 2 hours now before creating this thread 😄