So here’s how the code works: You kill somebody, it checks if your exp is higher than your requirement, if yes, a gui will appear displaying your new level, if not, nothing happens, just add 50 exp per kill.
Summary
game.Players.PlayerAdded:Connect(function(plr)
local stats = Instance.new("Folder")
stats.Name = "stats"
stats.Parent = plr
local kills = Instance.new("IntValue")
kills.Name = "Kills"
kills.Parent = stats
local deaths = Instance.new("IntValue")
deaths.Name = "Deaths"
deaths.Parent = stats
plr.CharacterAdded:connect(function(char)
local humanoid = char:FindFirstChild("Humanoid")
repeat
wait()
until humanoid
humanoid.Died:connect(function()
deaths.Value = deaths.Value + 1
local tag = humanoid:FindFirstChild("creator")
if tag then
local killer = tag.Value
local oof = killer.Character:FindFirstChildWhichIsA("Tool")
if killer then
plr.PlayerGui.Tags.death.death4.Text = ("Killed by " ..killer.Name)
plr.PlayerGui.Tags.death.death3.Text = oof.Name
plr.PlayerGui.Tags.death.death2.Text = math.ceil(killer.Character.Humanoid.Health).. ("/") .. math.ceil(killer.Character.Humanoid.MaxHealth).. (" HP")
plr.PlayerGui.Tags.death.Visible = true
local newtag = killer.PlayerGui.Tags.frame.kill:Clone()
newtag.Parent = killer.PlayerGui.Tags.frame
newtag.Visible = true
killer.Character.Humanoid.Health += 20
killer.stats.Kills.Value = killer.stats.Kills.Value + 1
killer.levels.EXP.Value += 50
if killer.levels.EXP.Value >= killer.levels.Killreq.Value then
killer.levels.Killreq *= killer.levels.Level.Value
killer.levels.EXP.Value = 0
killer.levels.Level.Value += 1
killer.tags.level.Visible = true
killer.tags.level.Text = ("LEVEL UP")
wait(5)
killer.tags.level.Visible = false
end
wait(3)
newtag.Text = ("(+50) Killed " ..plr.Name)
wait(3)
plr.PlayerGui.Tags.death.Visible = false
newtag:Destroy()
end
end
end)
end)
end)
What works: Exp adding, Kill adding, Gui appears for kill and death
What doesn’t: Level GUI appear when exp is higher than req