-- Levels up the player if they have enough experience to do so.

function PlayerLeveling:TryLevelUp(Player: Player, Level, XP)
	if PlayerLeveling:CanLevelUp(Player, Level, XP) then
		local Plus = math.floor(XP.Value / (Level.Value * XPPerLevel))
		local Remainder = math.clamp(math.floor(XP.Value - (Level.Value * XPPerLevel) * Plus), 0, math.huge)
		Level.Value = math.clamp(Level.Value + Plus, 1, math.huge)
		XP.Value = Remainder
	end
end

return PlayerLeveling
