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

Stats Gui is not showing the amount of kills? [Please Answer]

Asked by 7 years ago
Edited 7 years ago

So I was working on a Stats Gui for the player to see how many kills and how much EXP they have. I'm not sure what I scripted was correct and I can't seem to define the variable for kills. So can I be assisted?

local player = game.Players.LocalPlayer
local kills = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Kills

kills.Changed:connect(function()
    if player:FindFirstChild('leaderstats') then
    script.Parent.Text = 'Kills: ' .. kills.Value
    end
end)

Here're some screenshots I took to show you, https://gyazo.com/ac32de91f85833b48944abbe4fa72d26 https://gyazo.com/14df459ffd8e5763d8e7a23461c8c8f2

1
replace script.Parent.Parent.Parent.Parent.Parent.leaderstats.Kills with game.Players.LocalPlayer:WaitForChild("leaderstats"):FindFirstChild("Kills"). connor12260311 383 — 7y

1 answer

Log in to vote
1
Answered by 7 years ago

Hello. First of all, please don't add clickbait to your title such as "[Please Answer]". It does not make the chances of you getting a response any higher.

Second, your variable for kills is overly complex. You can shorten it to player.leaderstats.Kills, I imagine. However, your problem seems to be you're asking for it too quickly. If you change it to player:WaitForChild("leaderstats"):WaitForChild("Kills"), it should work (assuming that long list of script.Parents leads to the local player)

Ad

Answer this question