So my local script in the starterGUI is not giving XP on death of their own character. So when a person kills them, they get rewarded the XP. There are no errors so im guessing there is a problem at the "WaitForChild". I also tried to retrieve a value for "Character ". it returned nil

isDead = false

x = game.Players.LocalPlayer
Character = x:WaitForChild("Character") -- Problem?
Humanoid = Character:FindFirstChild("Humanoid")

Humanoid.Died:connect(function(onDeath)
	if not isDead then
		isDead = true
		local tag = Humanoid:findFirstChild("creator") 
		if tag ~= nil then
				local Folder = tag.Value:FindFirstChild("Folder")
				if Folder then
					Folder.CurrentXP.Value = Folder.CurrentXP.Value + 1
			end	 
		end
	end
end)

~ Thx, Bubs

4 comments

3

The problem is that Character is not a child of Player, it is a property, so: repeat wait() until p.Character Character = p.Character

0

Wow, Thanks So much dude :). 10/10 for support

0

np

0

Could, you put [SOLVED] in the name of it so we know it's been solved?