Okay, I have been going at this code for hours on end now, tried everything I can think of for a fix and yet my problem still occurs. The code works perfectly fine for level 1 to level 2 but after level 2 it suddenly starts adding 1 level per click of a move instead of adding the 20 exp that a move is supposed to add. I know that the problem is happening in this chunk of code I just don't know where. Someone please help before I lose my mind!

This is the chunk of code:

function exp(Value)
	
	if Player.leaderstat.EXP.Value >= Player.leaderstat.MaxEXP.Value then
		Player.leaderstat.EXP.Value = 1 --Player.leaderstat.EXP.Value - Player.leaderstat.EXP.Value
			wait()
		Player.leaderstat.LastLevel.Value = Player.leaderstat.LastLevel.Value + 1
			wait()
		Player.leaderstat.Level.Value = Player.leaderstat.LastLevel.Value + 1
			wait()
		Player.leaderstat.MaxEXP.Value = 15*(Player.leaderstat.Level.Value*2)
		GUI2.Exp.Bar.Size = UDim2.new(Player.leaderstat.EXP.Value/Player.leaderstat.MaxEXP.Value, 0, 0.65, 0)
	
	elseif Player.leaderstat.EXP.Value < Player.leaderstat.MaxEXP.Value and Player.leaderstat.EXP.Value >= 1 then
		GUI2.Exp.Bar.Size = UDim2.new(Player.leaderstat.EXP.Value/Player.leaderstat.MaxEXP.Value, 0, 0.65, 0)
	
	elseif Player.leaderstat.EXP.Value < 1 then 
		Player.leaderstat.EXP.Value = 1
	end
	
	if Player.leaderstat.Level.Value >= 300 then
		GUI2.Exp.Bar.Size = UDim2.new(0.955, 0, 0.65, 0)
	end
end

4 comments

0

Code's a lot easier to read when you indent it properly, man.

0

Yes, please indent the code. I'm straining my eyes trying to read it.

0

It is indented properly its just that the long lines of code go on to a second line which is annoying

0

You can space it out by using more lines, you know.