So the question is kind of self explanatory. I thought my script should work, but it doesn't. Here it is:
game.Players.PlayerAdded:connect(function(player)
local folder = Instance.new("Folder",player)
folder.Name = "leaderstats"
local currency1 = Instance.new("IntValue",folder)
currency1.Name = "Kills"
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
local tag = character.Humanoid:FindFirstChild("creator")
if tag ~= nil then
if tag.Value ~= nil then
-- Here tag.Value is the player who killed us, so find their leaderstats
local killersLeaderstats = tag.Value:FindFirstChild("leaderstats")
if killersLeaderstats then
-- Award the Kills to the player that killed us
killersLeaderstats.Kills.Value = killersLeaderstats.Kills.Value + 1
end
end
end
end)
end)
end)
Any idea what the problem is. Hope you can help thanks!
