game.Players.PlayerAdded:connect(function(player)
local stats = Instance.new('IntValue', player)
stats.Name = "leaderstats"
local Kills = Instance.new("IntValue", stats)
Kills.Name = 'Kills'
local Deaths = Instance.new("IntValue", stats)
Deaths.Name = 'Deaths'
local EXP = Instance.new("IntValue", stats)
EXP.Name = "EXP"
EXP.Value = 0
local Level = Instance.new("IntValue", stats)
Level.Name = "Level"
Level.Value = 1
player.CharacterAdded:connect(function(Character)
wait()
Character.Humanoid.Died:connect(function()
EXP.Value = EXP.Value + 100 --Each kill will give 100 EXP
Deaths.Value = Deaths.Value+1
wait()
if Character.Humanoid:FindFirstChild('creator') then
local Killer = Character.Humanoid.creator.Value
Killer.leaderstats.Kills.Value = Killer.leaderstats.Kills.Value + 1
end
end)
end)
if Level then --This if statement wont work for all levels D:
local anotherOne = Level + 1
if EXP.Value == anotherOne * 1000 then
EXP.Value = 0
Level.Value = Level.Value + 1
end
end
end)
--Having trouble making my if statement work for all levels. --I made EXP.Value = 0 so the EXP would reset and the player could start earning EXP again for the next level.

1 comment
Add a RequiredXP value