Help with level system

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

2 Likes

If the text is on a ScreenGui that isnt visable then you need to make sure anything parenting the TextGUI is visible.

Ive read through and dont see anything that will stop the script. The only thing I can say is you need to add prints to confirm whether or not it reaches the point where the frame should become visible

1 Like

I did :Clone() to clone the label and make it visible and the text was automatically set. Ill try the print though

Yea, sorry if it was obvious with the parents being visible, i struggle with the way you code but can still understand it.

For future referance, always use prints when testing as it makes it easier to follow the script when it runs.

1 Like