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
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)